The code you are using is not exactly getting the next auto-increment value. It's just getting the biggest ID and increases it by 1. You can do that even more simple like this:
PHP Code:
$get=mysql_query("SELECT MAX(id) FROM table");
$got = mysql_fetch_array($get);
$next_id = $got['MAX(id)'] + 1;
But that won't work. Auto-increment is assigning a unique value every time, even if you deleted some rows. The point is, if you delete the highest value, next time you add something it will take that value, and that's not unique is it? For example, you have an id values like this:
1
2
3
You then delete 3 so you get
1
2
Now if you use your code you'll get 3 as the next id value and you already had that value before. So it's not unique.
If you use my code you'll get 4 cos that's the next unique value that MySQL uses for it's auto-increment option. Four is unique because you NEVER had that id value before in your table.