Jump to content

Check if there are any results from mysql


vicodin

Recommended Posts

What i want to do is check if anything has retrieved from mysql or not. Any help would be appreciated.

 

Current code:

mysql_select_db("mediapil_mkmdata") or die(mysql_error());
$query = "SELECT * FROM products WHERE proid = $prodid";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
echo '

like this?

 

<?php
mysql_select_db("mediapil_mkmdata") or die(mysql_error());
$query = "SELECT * FROM products WHERE proid = $prodid";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result)){
  while($row = mysql_fetch_array($result)){

  }
}else{
  echo "No rows found";
}
?>

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.