...

View Full Version : Why doesn't this retrveive and display info?



dniwebdesign
01-09-2004, 10:56 PM
Please See New Post...

raf
01-10-2004, 01:06 AM
You missed a (concatination) dot before the $_SESSION['account '] inside your sql statement.

Maybe take a look at your other thread http://www.codingforums.com/showthread.php?s=&threadid=31197
to se how i write such code and what the advantages of other codingstyles are ...:rolleyes:

dniwebdesign
01-10-2004, 01:37 AM
Okay... It still doesn't seem to want to find the info... It knows the account number and the password from the form to login. This is confusing me...



<?php session_start(); ?>
<?php include 'home/sites/site58/users/dnidesign/web/clientarea/config.php'; ?>
<?php
$result=mysql_query("SELECT * from dnidesign_clients where account='".$_SESSION['account']."' and password='".$_SESSION['password']."'",$connection) or print mysql_error();
if(mysql_num_rows($result))
{
while($row=mysql_fetch_array($result))
{
$account=$row["account"];
$password=$row["password"];
$firstname=$row["firstname"];
$lastname=$row["lastname"];
$company=$row["company"];
$address1=$row["address1"];
$address2=$row["address2"];
$town=$row["town"];
$province=$row["province"];
$postalcode=$row["postalcode"];
$country=$row["country"];
$phone=$row["phone"];
$fax=$row["fax"];
$email=$row["email"];
$website=$row["website"];
$paid=$row["paid"];
$balance=$row["balance"];

$_SESSION['account'] = $account;
$_SESSION['password'] = $password; // Register session key with the value
$_SESSION['fullname'] = $fullname; // Register session key with the value
$_SESSION['company'] = $company; // Register session key with the value
$_SESSION['address1'] = $address1; // Register session key with the value
$_SESSION['address2'] = $address2; // Register session key with the value
$_SESSION['town'] = $town; // Register session key with the value
$_SESSION['province'] = $province; // Register session key with the value
$_SESSION['postalcode'] = $postalcode; // Register session key with the value
$_SESSION['country'] = $country; // Register session key with the value
$_SESSION['phone'] = $phone; // Register session key with the value
$_SESSION['fax'] = $fax; // Register session key with the value
$_SESSION['email'] = $email; // Register session key with the value
$_SESSION['website'] = $website; // Register session key with the value
$_SESSION['paid'] = $paid; // Register session key with the value
$_SESSION['balance'] = $balance; // Register session key with the value

}
}

?>

dniwebdesign
01-10-2004, 04:21 AM
?

raf
01-10-2004, 11:31 AM
if(mysql_num_rows($result))

is wrong.

I suppose you want to see if the number of returned rows is 1, so you need
if(mysql_num_rows($result)==1)

dniwebdesign
01-10-2004, 07:12 PM
Why do you need the ==1 on the end?

Nightfire
01-10-2004, 07:19 PM
So if there's one result, it'll continue. If there's no rows found, it returns "0", which'll still make it continue in your script

dniwebdesign
01-10-2004, 07:35 PM
It still didn't seem to help any though.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum