When i try to insert table i was get unique id but there is no records in my database. I cant understand what is the problem i am not getting any error. My code was working but stop automatically maybe something is wrong in my phpmyadmin please tell me how to find main problem or how to fix this issue and that happen with only one table other table working fine. I was try to repair table : not work
i can see my auto increment id is stuck on 42470 cant add new row please help…
$sql = mysqli_query($mysqli,"INSERT INTO yt_view (id,uid,url,current,total,timelimit,point) VALUES ('','$reg->id','$url','0','$reg->views','$reg->timelimit','$reg->point')") or dir(mysqli_error($mysqli));
mysqli_insert_id($mysqli); //Generated success but no record in db
I don’t know if I’d say need to though I agree AUTO_INCREMENT can take care of itself and unless you have reason to do otherwise it’s a very strong should.
No value was specified for the AUTO_INCREMENT column, so MySQL assigned sequence numbers automatically. You can also explicitly assign 0 to the column to generate sequence numbers, unless the NO_AUTO_VALUE_ON_ZERO SQL mode is enabled. If the column is declared NOT NULL, it is also possible to assign NULL to the column to generate sequence numbers. When you insert any other value into an AUTO_INCREMENT column, the column is set to that value and the sequence is reset so that the next automatically generated value follows sequentially from the largest column value.
For example, if “id” is auto_increment and you insert 10 rows without setting a value, they will be 1 to 10. If you then insert a row with an id value of 123, the next row inserted without setting a value the value will be 124, Values 11 to 122 will not exist. So I think in most cases it would be wise to let auto_increment do its thing unless missing values are of no importance. And there’s the possible error condition of inserting a value that already exists to think about too.