RTS Posted September 29, 2006 Share Posted September 29, 2006 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? Link to comment https://forums.phpfreaks.com/topic/22460-php-mysql-adding-to-id-number/ Share on other sites More sharing options...
akitchin Posted September 29, 2006 Share Posted September 29, 2006 cast it as an INT type, add the AUTO_INCREMENT attribute, and make it a PRIMARY KEY. simple as that. Link to comment https://forums.phpfreaks.com/topic/22460-php-mysql-adding-to-id-number/#findComment-100686 Share on other sites More sharing options...
RTS Posted September 29, 2006 Author Share Posted September 29, 2006 yes! thank you! Link to comment https://forums.phpfreaks.com/topic/22460-php-mysql-adding-to-id-number/#findComment-100687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.