spikypunker Posted January 19, 2009 Share Posted January 19, 2009 Is this possible?? This isn't working!! $i = 0; while ($i < $num) && ($i > '10') { $title = mysql_result($result2,$i,"title"); $image2 = mysql_result($result2,$i,"image"); echo "<a href='netdog-track.php?user=$user&title=$title'><img src='netdog/musicpics/$image2' height='80' width='80' border='0'> "; $i++; } Link to comment https://forums.phpfreaks.com/topic/141474-solved-multiple-conditions-for-a-while-statement/ Share on other sites More sharing options...
corbin Posted January 19, 2009 Share Posted January 19, 2009 The syntax of while is while condition Where condition is either true or false. So, what ever is in conditions place needs to be 1 thing, or evaluate to one thing. What am I getting at? You need more parenthesis. while(($i < $num) && ($i > 10)) { } You actually could cut out two pairs there though: while($i < $num && $i > $10) { } Link to comment https://forums.phpfreaks.com/topic/141474-solved-multiple-conditions-for-a-while-statement/#findComment-740536 Share on other sites More sharing options...
Mark Baker Posted January 19, 2009 Share Posted January 19, 2009 Except that the $i > '10' condition will never be met because you're setting $i to < 10 to start with $i = 0; while ($i < $num) && ($i > '10') Link to comment https://forums.phpfreaks.com/topic/141474-solved-multiple-conditions-for-a-while-statement/#findComment-740550 Share on other sites More sharing options...
spikypunker Posted January 19, 2009 Author Share Posted January 19, 2009 haha yeah i noticed that < typo but musta not changed it! Right cool ok man, thats just made me understand that bit more haha wicked, cheers! Link to comment https://forums.phpfreaks.com/topic/141474-solved-multiple-conditions-for-a-while-statement/#findComment-740787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.