preferred way to make a unique column id in sql database

Hi all I just wanted to know if there is a preferred way of creating a unique id within a sql table so far I have tried Auto-increment of the number and this started to cause problems in future planning, so I have thought about using the php Rand() and then turning this into a string and then insert this into a database but there is a higher chance off two numbers being the same with the amount of data that will be within the database.

I was just wondering if there any suggestions of a preferred way to create a unique column_id im open to all suggestions there is just a couple things the id needs to be easy enough to be used within other tables within inner joins and left outer joins and also used a file name as well for a download section and a upload section.


 echo uniqid();


use GUID

string com_create_guid ( void )

Need Your Help

/PM regex syntax for sending message in chat-room

javascript regex chatroom

I am working on a AJAX/PHP chatroom and am currently stuck on the regex to detect if a user has send a PM &amp; then work out who it is too and what the message is.