Jump to content

php mysql row, else?


dezkit

Recommended Posts

how do i do so if theres nothing in that table, i can echo "There isn't anything, yet."

 



while($row = mysql_fetch_array($result)){
  echo $row["member"];
  echo "<br>";
}


 

 

 

i was thinking



while($row = mysql_fetch_array($result)){
  echo $row["member"];
  echo "<br>";
} else {
echo "there are any members yet";
}


but it doesnt work.

Link to comment
https://forums.phpfreaks.com/topic/100906-php-mysql-row-else/
Share on other sites

$query="SELECT * FROM table WHERE this=this";

$result=mysql_query($query);

$number=mysql_num_rows($result);

 

if($number>0)

 

{

  while($row = mysql_fetch_array($result)){

  echo $row["member"];

  echo "<br>";

}

else

{

echo " NO users have joined";

}

Link to comment
https://forums.phpfreaks.com/topic/100906-php-mysql-row-else/#findComment-516029
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.