[PHP-SQL] Add a column with autoincrement data. Help!

SpaceshipSpaceship
Watch

Pichichi

Established Member
Impact
33
Hello

i am trying to make a thing that looks easy but it is taking me a lot of time and i am not sure how to make it...

I want to add a column in a sql database wich have to be filled from 1 to ... X. Is it possible to make it when adding the column?

The database is already created but i want to modify it to match with a project i have and i need a column with that index.

I've tried to make it throught php also, making a insert instruction for every record but it doesnt works...

Does anyone know how to make it easyly?

MANY THANKS in advance
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
1
•••
thanks, i will take a look!
 
0
•••
You have to make that value (name it something such as id) auto increment, set it up as the key(primary) and it has to be an integer. Do this through the mysql or PHPMyAdmin.

Then when you insert via PHP, you actually wouldn't specify the id as the database will do that for you.

See the highlighted areas below:

autoid.jpg
 
1
•••
thanks for the explanation tiawood :)
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back