Jump to content

Archived

This topic is now archived and is closed to further replies.

onthespot

serious help!

Recommended Posts

Please could you help me, the following is the code to login to my site:


[code]$sql="SELECT loginid FROM userlogin WHERE loginid=’".$loginid.”’ and password=’”.$password.”’”; $r = mysql_query($sql); if(!$r) {

$err=mysql_error();

print $err;

exit(); } if(mysql_affected_rows()==0){

print "no such login in the system. please try again.";

exit(); } else{

print "successfully logged into system.";[/code]



i am getting an error of [b]
Parse error: parse error, unexpected '=' in authenticate.php on line 5[/b]

i have not included the first 2 lines above this as they are just connecting and selecting the databse!
any ideas?

Share this post


Link to post
Share on other sites
You're using the wrong quote marks...use a single quote (') around the variables in your sql variable, not a back tic (`).  Also, you don't need to escape from the double quotes for your variables, however, it won't hurt anything if you do.

[code]$sql = "SELECT loginid FROM userlogin WHERE loginid = '$loginid' and password = '$password'";[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.