Link to home
Start Free TrialLog in
Avatar of designersx
designersx

asked on

how to write this in coding terms?

how to write in the programing language that

if there is no record in the database the show the message
Empty Records
else show all the records from the database.

ASKER CERTIFIED SOLUTION
Avatar of Thomas Aamodt
Thomas Aamodt
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi aamodt,

I have done a little modification in your code.

<?php
mysql_connect('ipaddress','username','password');
mysql_select_db('database');
 
$result = mysql_query("SELECT * FROM table where field='something'");
 
if(mysql_num_rows($result) == 0) { 
	echo 'Empty Records';
} else {
	while ($row = mysql_fetch_array($result)) {
		echo $row['id'].' - '.$row['test'].'<br />';
	}
}
 
?>

Open in new window