Page 1 of 1

Problem with an if statement and while loop

Posted: Thu Nov 27, 2008 2:27 pm
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

Re: Problem with an if statement and while loop

Posted: Thu Nov 27, 2008 2:40 pm
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.

Re: Problem with an if statement and while loop

Posted: Thu Nov 27, 2008 2:48 pm
by mmj
I think you should take a look at Lisp. :mrgreen:

(referring to all those parentheses)