In my database I have a field called spaj_per
as an auto increment primary key.
How can I display the lastest inserted value in the field spaj_per
. I tried this.
<?php
$con = mysql_connect("localhost", "SuperAdmin", "***");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("sistem_pengurusan_fail",$con);
$q = "SELECT MAX(id) AS spaj_per FROM unit_pengambilan";
$result = mysql_query($q);
$row = mysql_fetch_array($result);
?>
<?php echo $row['spaj_per']; ?>
But it won't work.