I have a question about counting rows, mostly just where to place the code. Here is what I currently have for code:
<?php
$criteria1 = "$_POST[criteria1]";
$criteria2 = "$_POST[criteria2]";
include 'config.php';
/*** create a new mysqli object with default database***/
$connection = mysqli_connect($hostname, $username, $password, $dbname) or die ("Unable to connect");
//create query
$query = "SELECT id, serial_no, order_no, board_no FROM production where $criteria2 like '$criteria1' ORDER by id DESC";
//excute query
$result = mysqli_query($connection, $query) or die ("Error in query: $query. ".mysqli_error());
// see if any rows were returned
if (mysqli_num_rows($result) > 0) {
// yes
// print them one after another
while (list($id, $serial_no, $order_no, $board_no) = mysqli_fetch_row($result))
{
echo " <tr>
<td><div align=center><a href=order_info.php?id=$id>$serial_no</div></td>
<td><div align=center>$order_no</div></td>
<td><div align=center>$board_no</div></td>
</tr>";
}
echo "</table>";
}
else {
// no
// print status message
echo "<tr><td colspan=3><div align=center>No rows found!</div></td></tr>";
echo "</table>";
}
// free result set memory
mysqli_free_result($result);
// close connection
mysqli_close($connection);
?>
I know this is not to complicated, but I just don't get it. Thanks in advance for any help.
A