I have a field outlet_id having values like this:
AA1
AA2
AA3
AA4
It's not mysql auto incrementing field. I have to fetch the last value inserted into the outlet_id and increment it like AA5,AA6,AA7 ...
What I have done so far is:
$sql_outlet_id=mysql_query("SELECT MAX(outlet_id) FROM outlets");
$val = mysql_fetch_row($sql_outlet_id);
$new_array = explode('AA',$val[0]);
echo $outlet_id=$new_array[1]+1;
Output always shows 10 even if last inserted id is AA20 or AA21 or so on.