I am fairly new to PHP. I have written some code that adds 1 to the highest value in a database and stores it in a variable.
Code: Select all
$query = mysql_query("SELECT MAX(id) as maxnum FROM users");
$id = mysql_fetch_array($query);
$id = $id[maxnum]+1;A) I have done this correctly, or if there is a better/easier way to do this?
B) Why I can't say: $id = $id[maxnum]++; ?