jeff5656 Posted August 18, 2010 Share Posted August 18, 2010 I get this error so I was wondering if it is because I can't put a while inside a foreach? "syntax error, unexpected T_WHILE in home/g/h/t...." while($rows=mysql_fetch_array($rr)){ $pt_id = unserialize($rows['pts']); foreach ($pt_id as $indiv) { $q = "select * from indiv where id_incr = '$indiv'"; echo $q; $result = mysql_query($q) while $ptrow =mysql_fetch_array($result)){ echo $ptrow['v1']; echo "<br>"; } } } Quote Link to comment Share on other sites More sharing options...
btherl Posted August 18, 2010 Share Posted August 18, 2010 The error is that you missed the ";" on the end of the line before the "while". So it thinks you're trying to put the "while" as part of the same command where you set $result. Quote Link to comment Share on other sites More sharing options...
jeff5656 Posted August 18, 2010 Author Share Posted August 18, 2010 Thanks! 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.