Jump to content

[SOLVED] Multiple conditions for a While statement???


spikypunker

Recommended Posts

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++;

}

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) {

 

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.