| View previous topic :: View next topic |
| Author |
Message |
tom fallow
Joined: 30 Dec 2005 Posts: 27 Location: PA
|
Posted: Fri Jan 13, 2006 9:39 pm Post subject: |
|
|
Well, I tried changing the '>= 1' on the line:
if ($mysql_num >= 1) {
...to '< 1'
What I got was a Warning: Cannot modify header information - headers already sent by....
Now I'm really confused!  |
|
| Back to top |
|
 |
tom fallow
Joined: 30 Dec 2005 Posts: 27 Location: PA
|
Posted: Fri Jan 13, 2006 9:50 pm Post subject: |
|
|
...and this is strange...
If I enter the word Propertyname in the textfield, I get the echo message! Entering in already inserted Propertyname values still gets no result. |
|
| Back to top |
|
 |
Fed Site Admin

Joined: 12 Aug 2005 Posts: 176
|
Posted: Fri Jan 13, 2006 10:21 pm Post subject: |
|
|
headers already sent by...?*?
you might have some white spaces/lines at the beginning of the page where you are sending the visitor (that should be named in place of ?*? )
maybe error-userexists.php ? |
|
| Back to top |
|
 |
tom fallow
Joined: 30 Dec 2005 Posts: 27 Location: PA
|
Posted: Fri Jan 13, 2006 10:43 pm Post subject: |
|
|
I thought that too, so I changed the "errorexists" page to the "Untitled-1" page that I'm working on and the same error comes up. But the real problem is that the values in the database in column "Propertyname" do not trigger the redirect and echo "duplicate user". The only thing that triggers that is when I enter the word "Propertyname" in the textfield. There is no record under the column Propertyname that has the value "Propertyname" so I'm at an impasse here.
Here's the total of what I have...
<?php require_once('db1config.php');
require_once('db1connect.php');
if (isset($_POST['Submit'])) // if form submitted - process it
@mysql_select_db("rentlogin") or die("Unable to select database");
$Propertyname = $_POST['Propertyname'];
$column = "Propertyname";
$table = "owner_prop";
$sql = mysql_query("SELECT $column FROM $table WHERE 'Propertyname' =\"$Propertyname\"") or die ("query 1: " . mysql_error());
$mysql_num = mysql_num_rows($sql);
echo $mysql_num;
if ($mysql_num >= 1) {
header("Location: /Untitled-1.php");
echo "Cannot insert duplicates";
Die();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post" name="Propertyname" id="Propertyname">
<p>
<input name="Propertyname" type="text" id="Propertyname">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html> |
|
| Back to top |
|
 |
Fed Site Admin

Joined: 12 Aug 2005 Posts: 176
|
Posted: Fri Jan 13, 2006 10:59 pm Post subject: |
|
|
have you inserted a record with the Propertyname value?
have you tried with the query without the single quoted Propertyname?
SELECT $column FROM $table WHERE Propertyname =\"$Propertyname\"
does this query work in phpmyadmin?
SELECT Propertyname FROM tablename WHERE Propertyname ="Propertyname";
I am a bit confused with this amount of Propertynames  |
|
| Back to top |
|
 |
tom fallow
Joined: 30 Dec 2005 Posts: 27 Location: PA
|
Posted: Fri Jan 13, 2006 11:04 pm Post subject: |
|
|
Ok, I found out what I was doing wrong...WHERE 'Propertyname' should have been WHERE $column...
That's one big step ...
I looked for all of the whitespace I could find and got rid of it.
But I'm still getting the error..."Warning: Cannot modify header information - headers already sent by (output started at c:\apache 2005-12\Apache\htdocs\Rent\tmp3vypnt1x5z.php:10) in c:\apache 2005-12\Apache\htdocs\Rent\tmp3vypnt1x5z.php on line 12"
for those following this, this is the best code so far...
<?php require_once('db1config.php');
require_once('db1connect.php');
if (isset($_POST['Submit'])) // if form submitted - process it
@mysql_select_db("rentlogin") or die("Unable to select database");
$Propertyname = $_POST['Propertyname'];
$column = "Propertyname";
$table = "owner_prop";
$sql = mysql_query("SELECT $column FROM $table WHERE $column =\"$Propertyname\"") or die ("query 1: " . mysql_error());
$mysql_num = mysql_num_rows($sql);
if ($mysql_num >= 1) {
header("Location: /Untitled-1.php");
echo "Cannot insert duplicates";
Die();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form action="" method="post" name="Propertyname" id="Propertyname">
<p>
<input name="Propertyname" type="text" id="Propertyname">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html> |
|
| Back to top |
|
 |
Fed Site Admin

Joined: 12 Aug 2005 Posts: 176
|
Posted: Fri Jan 13, 2006 11:11 pm Post subject: |
|
|
what is there at line 10 (and around...previous and following) in this page? tmp3vypnt1x5z.php (it should be the copy generated by dreamweaver - or whatsoever you are using - while you try to run it in your browser)
be aware that you might experience issues while moving from your local machine to the server due to discrepancies between windows and unix charsets (dunn' if this is the right term.....by the way I mean case sensitive against non case sensitive) so you might have to rework on your database code
if you already have a hosting plan I suggest you to finish coding it directly on the server. |
|
| Back to top |
|
 |
tom fallow
Joined: 30 Dec 2005 Posts: 27 Location: PA
|
Posted: Fri Jan 13, 2006 11:30 pm Post subject: |
|
|
Thanks Fed...I don't have a host at the moment...I figured I'd develop the sit first and then throw it up.
I shut down Dreamweaver and brought it back up and everything works great now!
So I copied and pasted the code to the page I needed it for and when I enter an existing value for the field "Propertyname", I get nothing....no redirect, no echo statement.
I have a feeling that the "form action="/ownerprop2.php" method "post" somehow overrides the code I pasted above it, just not sure how to fix it. |
|
| Back to top |
|
 |
Fed Site Admin

Joined: 12 Aug 2005 Posts: 176
|
Posted: Fri Jan 13, 2006 11:36 pm Post subject: |
|
|
I'm sorry we can't find a solution...you know...working on the same monitor and discussing it live maybe we'd have got it in 5 minutes :\
usually when I get to a deadlock I restart it all from scratch but it seems that you are quite done....it would be too wasted work |
|
| Back to top |
|
 |
tom fallow
Joined: 30 Dec 2005 Posts: 27 Location: PA
|
Posted: Fri Jan 13, 2006 11:46 pm Post subject: |
|
|
Thanks Fed. I don't see it as a total waste...I just think that I have to edit the form action somehow...at least I know that the code works by itself Really appreciate your input, by the way. I couldn't have done it without the help. |
|
| Back to top |
|
 |
|