Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Problem with database reading

Where did the value go?



8:59 pm on Aug 30, 2003 (gmt 0)

10+ Year Member

I'm new to PHP and I am doing a new site with it to learn.
This is doing my head in .I can't see why a variable is losing a value. There must be something I don't know. (or a very silly error somewhere.) Can anyone help?

This is the code with all the sensitive values removed.
I've marked the lines between which the value of $passworddb vanishes. The "loop indicator" is just there
to show that there is a single record in the database that matches.

if ($logon)
$user= "*****";
$query="select * from table where nickname='test'";
while (list($nicknamedb,$passworddb) = mysql_fetch_row($back))
print" Database password ".$passworddb."<br> \n"; # BETWEEN HERE
print "loop indicator<br>";
print "database password ".$passworddb." input password ".$password; #AND HERE
if ($passwordo!= $password)
$error1 ="Sorry, there is nobody registered with those details.";
<form action="" method=post name="">
<input maxlength=10 name=nickname size=10>
<input maxlength=8 name=password size=8 type=password>
<input type="submit" name="logon" value="logon">
<? if ( $error1) {

Here is the output.

Database password e98009
loop indicator
database password input password e98009


10:33 pm on Aug 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



10:36 pm on Aug 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Like this:

while($resultset = mysql_fetch_array($back)){
print" Database password ".$resultset['Password']."<br> \n";

Make sure that you match your column name you used for password in the quotes.


Featured Threads

Hot Threads This Week

Hot Threads This Month