I am using this code to find the number of lines in particular orders stored in an order Items table, works just fine except that it doesn't fail but returns 0 when I query with a non existent order number. Can I get round this in SQL or should I filter for the 0 in php after the query?
$sql = "SELECT MAX(`lineNumber`) FROM OrderItems WHERE `orderNumber` = $_POST[orderNumber]";
$resultS1 = mysql_query( $sql ) or die( "fail line number" . mysql_error() );
$row = mysql_fetch_array($resultS1);
$lineNumber = $row;
$lineNumber = $lineNumber + 1;