Im trying to get the last id after inserting data into mysql.I already try using mysql_insert_id() but it seem doesn't work.
Below is the PHP code :
function addPhoneContact($customername ,$address ,$email ,$comment,$remarks){
$connection = MySQLConnection();
$conf = new BBSupervisorConf();
$log = new KLogger($conf->get_BBLogPath().$conf->get_BBDateLogFormat(), $conf->get_BBLogPriority() );
$query="INSERT INTO bb_customer
(customername,address ,email ,comment,remarks)
VALUES
('".$customername."','".$address."','".$email."','".$comment."','".$remarks."');";
$customerid = mysql_insert_id();
try {
$log->LogDebug("Query[".$query."]");
if (!mysql_query($query)){
die (mysql_error());
}else{
}
}catch(Exception $e){
$log->LogError($e->getMessage());
}
closeDB($connection);
return $customerid;
}
Thanks for your help.