Jump to content

Archived

This topic is now archived and is closed to further replies.

RTS

PHP / MYSQL Adding to ID Number

Recommended Posts

I am adding a private messaging system to my website, and am wondering, how do I add a distinct ID number to each message. I  have a column named ID in a table called messages in a database called test. I want it to be so the first message will have id = 1, seccond message id = 2, and so on and so forth. Is this easy? How would I do it?

Share this post


Link to post
Share on other sites
cast it as an INT type, add the AUTO_INCREMENT attribute, and make it a PRIMARY KEY.  simple as that.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.