error message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rwahdan
Forum Newbie
Posts: 23
Joined: Thu Feb 12, 2009 1:49 am

error message

Post by rwahdan »

Hi all,

I have error message that i dont understand and dont know where to look for the error?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where user_password='rami2009'' at line 1

I have found the problem. i had two where statements in the same row!

my problem now is that i dont get any error and i dont get anything printed on the screen and i dont know why! here is the code:

$host="xxx.com";
$db_name="xxx";
$username="xxx";
$password="xxx";
$theid=$_POST['loginid'];
$thepass=$_POST['password'];

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");


$results= mysql_query("SELECT user_id, user_password FROM tbl_auth_user WHERE user_id='$theid' and user_password='$thepass'") or die(mysql_error());
$row = mysql_fetch_array($results);
$var1 = $row['user_id'];
$var2 = $row['user_password'];


echo $var1;
echo $var2;
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: error message

Post by susrisha »

do a print_r for the row

Code: Select all

 
print_r($row);
 
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: error message

Post by susrisha »

and please dont post the passwords and other sensitive information in the forum..
ps: I was able to login to your system.. Its quite insecure if it falls in wrong hands..
Post Reply