Jump to content

mysql num rows not working?


MDanz

Recommended Posts

It should echo "test" because there are no results that match the query, instead it echo's "offwal"?

 

<?php

mysql_connect("localhost", "Master", "pword");
mysql_select_db("db");

$officialwallpaper = mysql_query("SELECT wallpaper, MAX(points) FROM Contribute WHERE stack LIKE '%test%'")or die (mysql_error());

while($wallrow = mysql_fetch_array( $officialwallpaper)) {

$offwall = $wallrow['wallpaper'];
}
$officialfound = mysql_num_rows($officialwallpaper);

if($officialfound==0) {


echo "test";
} else {
  echo "offwall";

}






?>

Link to comment
https://forums.phpfreaks.com/topic/201392-mysql-num-rows-not-working/
Share on other sites

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.