Greenmethod
Sep 18th 2007, 3:38 pm
$highest_po_result = mysql_query("SELECT po_num FROM `inventory`");
$high_po = mysql_fetch_array($highest_po_result);
echo 'max: ' . max($high_po) . '<br>';
echo 'num rows: ' . mysql_num_rows($highest_po_result) . '<br>';
if (0 == mysql_num_rows($highest_po_result)){
echo 'newpo';
$new_po = 1;
}
else {
$new_po = max($high_po);
$new_po = $new_po+1;
}
I have the exact code written on another page and it works fine, but this just gives me max is 1 and num_rows is the actual number of rows every time.
I don't know what else I can do to troubleshoot.. any ideas?
$high_po = mysql_fetch_array($highest_po_result);
echo 'max: ' . max($high_po) . '<br>';
echo 'num rows: ' . mysql_num_rows($highest_po_result) . '<br>';
if (0 == mysql_num_rows($highest_po_result)){
echo 'newpo';
$new_po = 1;
}
else {
$new_po = max($high_po);
$new_po = $new_po+1;
}
I have the exact code written on another page and it works fine, but this just gives me max is 1 and num_rows is the actual number of rows every time.
I don't know what else I can do to troubleshoot.. any ideas?