The following keeps giving me "2" as a result, however there are now 30 records in the table !
$result = mysql_query("select MAX(OrderNum) as maxnum FROM Ordnum");
echo "order number: $result<BR>";
Here is how I have been adding new records:
$TodaysDate=date("Ymd");
$today = getdate();
$Year = $today[year];
$mon = $today[mon];
$mday = $today[mday];
$nyear = substr($Year,2);
$day="$nyear$mon$mday";
// gives me "01530"
echo "$day<BR>";
// increment order number
mysql_query("insert into Ordnum (Day) values ('$day')");
What should I change to display to highest record number ?
Thanks,
Peter
David wrote:
$result = mysql_query("select MAX(OrderNumber) as maxnum FROM OrdNum");
now you can refer to it as "maxnum" or whatever you want to call it like
$row["maxnum"]
hope this helps.
ace