Of course, you'll need to put some error checking in, but what I've posted above is the basic code to do what you want.
* Define $server, $username, $password, $database and $table here as follows:
* $server = name of mysql server.
* $username = username for mysql account.
* $password = password for mysql account.
* $database = name of database to use.
* $table = name of table containing the id column.
$conn = mysql_connect($server, $username, $password);
$res = mysql_query("select max(id) from $table;");
$data = mysql_fetch_array($res);
$count = $data;