Page 1 of 1

would this work??

Posted: Mon Aug 01, 2005 4:16 pm
by ericburnard
just woundering if this would work to give you a link like this ---- http://eric.madashatters.com/readmail.p ... oop&mail=1


$username = mysql_real_escape_string($_GET['user']);
$mail = mysql_real_escape_string($_GET['mail']);
$query = "SELECT * FROM pm WHERE user='$username' AND WHERE id='$mail'";
$result = mysql_query($query) or die(mysql_error());

thanks
Eric

Posted: Mon Aug 01, 2005 4:34 pm
by timvw
You have a syntax error.. As you notice yourself when you visit the page:

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 id='0'' at line 1
Should be WHERE id='0' , thus in a string becomes "WHERE id='0'"

Posted: Mon Aug 01, 2005 4:59 pm
by ericburnard
i can see that it is ment to be WHERE id='0' but have played around with the code but it dosnt want to work :s

what am i doing wrong :S

Eric

ps. sorry for taking up your time tonight timvw i really apprechiate it (even thought i cant spell it :P)

Posted: Mon Aug 01, 2005 8:55 pm
by Burrito
you have two instances of "where" in your query.

you only need one for your where clause:

Code: Select all

$query = "SELECT * FROM pm WHERE user='$username' AND  id='$mail'";

Posted: Mon Aug 01, 2005 9:03 pm
by Ambush Commander
MySQL cannot handle multiple WHERE keywords, so once it sees the second WHERE it bails out. That's why it says the error is over there. Learn how to interpret error messages: it does the body good.

Posted: Tue Aug 02, 2005 6:42 am
by ericburnard
Is that all it is :D lol
Thank you very much :D

Eric