Problem with an if statement and while loop

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
ViserExcizer
Forum Newbie
Posts: 24
Joined: Tue Nov 25, 2008 1:17 pm

Problem with an if statement and while loop

Post by ViserExcizer »

What is wrong with this code?


$result = mysql_query("SELECT * FROM sites");
$resultz =mysql_query("SELECT * FROM users WHERE user=$ref");


if ((($r1=mysql_query($result)) && ($r2=mysql_query($resultz))) {
while ((($row=mysql_fetch_assoc($r1))||($row=mysql_fetch_assoc($r2))) {


echo"Your referer is ". row["referer"] .;

}

}




it keeps saying: Parse error: syntax error, unexpected '{' in line 32

line 32 is the same line as the if statement
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Problem with an if statement and while loop

Post by John Cartwright »

Count your opening and closing brackets.

BTW -- What on earth are you trying to do? I would suggest looping both your resultsets seperately.
mmj
Forum Contributor
Posts: 118
Joined: Fri Oct 31, 2008 4:00 pm

Re: Problem with an if statement and while loop

Post by mmj »

I think you should take a look at Lisp. :mrgreen:

(referring to all those parentheses)
Post Reply