This is the second part of a script. It gets the EAN from the form in the first part.
Where there are sales, it will show total number but if not I want to show a message to say "none" or "No Sales". Don't quite get the else/if errors. Could someone suggest what I've done wrong.
<?php
include 'db.php';
$term = $_POST['EAN'];
$term = TRIM($term);
$sql = mysql_query("SELECT Name, Brand, EAN, sum(orderedquantity) As SumS
FROM $salesdb
WHERE EAN LIKE '%$term%' Limit 0,5");
while ($row = mysql_fetch_array($sql))
{
if($row['SumS'] <'1')
{
Print '<table style="width:100%;margin-left:auto;margin-right:auto" border=1><font face=arial size=2 > <tr><td>Sales 2012:<b>"None Sold"</b></td></tr></table>';
}
else
{
Print '<table style="width:100%;margin-left:auto;margin-right:auto" border=1><font face=arial size=2 >
<tr><td>Sales 2012:<b>'.$row['SumS'].'</b></td></tr></table>';
}
?>