hey im recalling info from a database, and i was wondering if there was a way to do the following? i want to recall the row in the table, if the $type field is not equal to 'rock'
if ($type == rock) echo "blah blah";
thanks
$query = mysql_query("SELECT * FROM your_table"); while($row = mysql_fetch_array($query)) { if ($row["type"] != 'rock') { // if type field does not equal rock // do whatever } else { // type field does equal rock // do something else } // end while loop }
Cgraz
Or you could just put this in your query:
$sql = "SELECT * FROM table WHERE type != 'rock'"; $query = mysql_query($sql);
That way you don't even get the rock stuff.
if i wanted to recall all the rows in the table that have any value for the $type variable... i got
if ($type != null) { echo "all the results"; }
.......etc
mmmm...?!?