/ Published in: HTML

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function mysql_autoid($id,$table){ $query = 'SELECT MAX('.$id.') AS last_id FROM '.$table; $result = mysql_query($query); $result = mysql_fetch_array($result); return $result[last_id]+1; } // usage mysql_autoid('nID','news'); // for use with fields that don't have auto_increment enabled // otherwise just use $last_id = mysql_insert_id(); following a successful INSERT
Comments
