primary key - MySQL ID Increment Conundrum -
i have mysql table auto increment. i'm using id primary key.
here structure of key:: id int(255) no none auto_increment
this how increments have happened:

as can see xxxxxxxxyy series, yy numbers incremented.
this insert statement.
$id = $this->get_next_id($this->get_last_id()); $q = 'insert '.url_table.' (id, url, date, title, image, description) values ("'.$id.'", "'.$url.'", now(), "'.$title.'", "'.$image.'", "'.$description.'")';
there no need give new id. column auto_increment, increment automatically (hence name).
just insert this, , let database handle increments:
$q = 'insert '.url_table.' (url, date, title, image, description) values ("'.$url.'", now(), "'.$title.'", "'.$image.'", "'.$description.'")'; (just omit id column altogether)
Comments
Post a Comment