emediastudios Posted June 6, 2008 Share Posted June 6, 2008 I wanted to show the record count, total records, and i also wanted to show the text :There are no records if the table is empty. How would i include that in this code. <?PHP $query = "SELECT * FROM salon_accounts"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<form action='delete_links.php' method='post' target='_self'><br><h3>Salon Application # $row[id]<h3><table width='800' class='border'> <tr> <td width='200' class='td2'>Company name :</td> <td class='td1'>$row[company_name]</td><tr> <td class='td2'>Trading name :</td><td class='td1'>$row[trading_name]</tr></tr> <td class='td2'>acn abn :</td><td class='td1'>$row[acn_abn]</tr></tr> <td class='td2'>Street address :</td><td class='td1'>$row[street_address]</tr></tr> <td class='td2'>Postal address :</td><td class='td1'>$row[postal_address]</tr></tr> <td class='td2'>Owners name :</td><td class='td1'>$row[owner_name]</tr></tr> <td class='td2'>Contact number :</td><td class='td1'>$row[contact_number]</tr></tr> <td class='td2'>E-mail :</td><td class='td1'>$row[email]</tr></tr> <td class='td2'>Salon website :</td><td class='td1'>$row[salon_website]</tr></tr> <td class='td2'>Contact method :</td><td class='td1'>$row[contact_method]</tr></tr> <td class='td2'>Contact time :</td><td class='td1'>$row[contact_time]</tr></tr> <td class='td2'>Survey :</td><td class='td1'>$row[survey]</tr></tr> <td class='comments1'>Comments :</td><td class='comments'>$row[comments]</tr></tr> </table> <br/><a href='delete_links.php?action=delete&id=$row[id]'>DELETE FILE</a></form>"; } ?> Link to comment https://forums.phpfreaks.com/topic/108949-show-record-count/ Share on other sites More sharing options...
tapos Posted June 6, 2008 Share Posted June 6, 2008 use mysql_num_rows() Link to comment https://forums.phpfreaks.com/topic/108949-show-record-count/#findComment-558954 Share on other sites More sharing options...
Buddski Posted June 6, 2008 Share Posted June 6, 2008 for example. if (mysql_num_rows($result) > 0) { // Rows are Found // Do something nifty } else { //Aint nothing there } Also i strongly suggest checking over your table markup..its a little crazy looking. eg. <tr> <td width='200' class='td2'>Company name :</td> <td class='td1'>$row[company_name]</td><tr> <td class='td2'>Trading name :</td><td class='td1'>$row[trading_name]</tr></tr> Link to comment https://forums.phpfreaks.com/topic/108949-show-record-count/#findComment-558982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.