Auto Incrementation MySQL and PHP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Auto Incrementation MySQL and PHP

Hi everyone! I've got a problem with my database. On my website i have table with some data. You can add data and also you can delete data. When I delete lets say the 3 row from my table, the order is 1.... 2... 4.... so the 3 is missing. How to set up my mysql database or php script to automaticlly set incrementation from 1 to last item in database? Adress to the website (example): http://th.web-expert.co.uk/zdalnezadanie/delegacje.php

4th Dec 2019, 9:21 PM
Karol TusiƄski
Karol TusiƄski - avatar
2 Answers
0
Hello Karol TusiƄski , I don't think I'm understanding your question here. So let me confirm this now, you are deleting 3 rows from a table (record 1, 2 and 4). Is this what you mean? but what did you mean by "so the 3 is missing."? I really lost you on the "to automatically set increment from 1 to last item in database". Can you elaborate more on that idea? I think it would help better to understand if you included your SQL query in your question and perhaps structure of the table you talked about. P.S. I saw access denied message in that page. But the page content didn't help me in understanding the problem, unfortunately.
5th Dec 2019, 3:59 AM
Ipang
0
Let's say I have 10 elements in database from 1 to 10. I delete for example 6 element. The list is 1 2 3 4 5 7 8 9 10. 6 is missing. So I'd like to reset the order to be 1 2 3 4 5 6 7 8 9.
5th Dec 2019, 10:19 AM
Karol TusiƄski
Karol TusiƄski - avatar