Is there some way to have a unique key in a table? Like having this entry:
(Unique_Key,2143,"This is goooood")
and the Unique_Key specifices this entry uniquely.... For example the unique_key could be just the number of entries in the table at insertiontime. But is there a way to make MySQL find this key automatically when i insert a new post in the table?
(you could do this "by hand" by counting the entries in the table before you do the insertion, but Im kinda lazy. And you proberly get into all kinds of problems with "consistency". Ie. you have to lock the database when doing this.)
Hello madsen
these are excerpts I got from mysql.com I recommend you to visit their site They have nice documentations.
you can have a field definition in y our table create in mysql like
[AUTO_INCREMENT] [PRIMARY KEY] are what you look for, One makes column unique and other one increments this by one(type is one of integer types).
If you insert a record in a table containing a column that has the AUTO_INCREMENT attribute, you can get the most recently generated ID by calling the mysql_insert_id() function.
Bookmarks