itsureboy Posted July 5, 2009 Share Posted July 5, 2009 I'm new to PHP and everything, so I was wondering. Is it possible to assign a WHILE loop to a variable. I am trying this, just in case it is even possible. $query = while($row = mysql_fetch_array($result)){ echo ' OR commenterid = '.$row['friendid'].' '; }; And get the error: Parse error: syntax error, unexpected T_WHILE Thanks ahead, Chris Quote Link to comment Share on other sites More sharing options...
trq Posted July 5, 2009 Share Posted July 5, 2009 while() doesn't return anything, what do you expect? Maybe you want something more like?.... $query = ''; while($row = mysql_fetch_array($result)) { $query .= ' OR commenterid = ' . $row['friendid']; } Quote Link to comment Share on other sites More sharing options...
itsureboy Posted July 5, 2009 Author Share Posted July 5, 2009 It worked! You don't know how thankful I am. =) THANK YOU!!!!!!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.