easy PHP/MYSQL question

Soldato
Joined
22 Jun 2004
Posts
2,693
Location
South Scotland
dabbling with PHP/MYSQL and it works ok but stupidly havign difficulty in returning informative text (eg; no results returned) when no matching records are returned, the code below works to retrieve.
How do I return the no results returned etc?


Code:
$link_id = mysql_connect("localhost","root","**********");

  mysql_select_db("printservers",$link_id);

 

$sql = "SELECT * FROM printserverstable";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
 {




echo "<center><table WIDTH = 810 BORDER =1>";
echo "<tr width = 810>";
echo "<td WIDTH = 110>".$row['location']."</td>";
echo "<td WIDTH = 110>".$row['sublocation']."</td>";
echo "<td WIDTH = 140>".$row['brand']."</td>";
echo "<td WIDTH = 110><A HREF = ".$address,$row['ipaddress'].">".$row['ipaddress']."</A></td>";
echo "<td WIDTH = 110>".$row['updatedby']."</td>";
echo "<td WIDTH = 140>".$row['comments']."</td>";
echo "<td WIDTH = 110>".$row['id']."</td>";
echo "</tr>";
echo "</table></center>";


}
 
how simple was that?, superb, thanks a lot , dunno if ure code was a typo but I changed
Code:
mysql_num_results
to
Code:
mysql_num_rows
and wey hey it works , many thanks mate, I was on the right track conceptually/logically but unfortunately ws too much of a dullard to get there myself :eek:

now to paging the results..... :confused:
 
Back
Top Bottom