$q = "SELECT product_id, product_name, product_desc, product_cust FROM tblProducts ORDER BY product_id ASC";
$r = @mysqli_query ($dbc, $q); // $dbc is your database details, you will need to define this somewhere, maybe seperate file //
$num = @mysqli_num_rows($r); // this will count the number of rows in your products table //
if ($num > 0) { // if there are more than 0 rows it will tell user how many rows there are //
echo "<p>There are currently $num products.</p>\n";
echo '<table align="center" cellspacing="3" cellpadding="3" width="85%">
<tr>
<td align="left"><b>Product ID</b></td>
<td align="left"><b>Product Name</b></td>
<td align="left"><b>Product Description</b></td>
<td align="left"><b>Username</b></td>
</tr>';
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo '<tr>
<td align="left">' . $row['product_id'] . '</td>
<td align="left">' . $row['product_name'] . '</td>
<td align="left">' . $row['product_desc'] . '</td>
<td align="left">' . $row['product_cust'] . '</td>
</tr>';
}
echo '</table>';
mysqli_free_result ($r);
} else {
echo '<p>There are currently no products.</p>'; // otherwise it will tell the user there are no products in the table //
}
Is this what you want?