HI i want to add an id to every member on my topsites list to use on a rating script iv made what is the sql so every time a member joins they will get a difrent id like so it counts the amount of ids and then +1 for the id if you no what i meen. Thanks in advanced.
Set up the table so that the ID field is a primary key and is set to auto-increment. Then when you insert rows, it will automatically add the id as the next number. If you are using mysql, you can then find what the id is for the row you just inserted with mysql_insert_id().
ALTER TABLE `table name` ADD `id` VARCHAR( 11 ) NOT NULL AUTO_INCREMENT FIRST error = #1063 - Incorrect column specifier for column 'id'
now i get this error: #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
You need to drop the existing primary key. If you want someone to do it for you, hire a programmer. Otherwise use a little common sense and don't expect everything on a silver plate. Every error message so far has been in plain english which you could easily solve with a little research and trial and error. There's plenty of people happy to help but you need to help yourself as well.
Ok thanks now i look i can see what is wrong i dono why it did no pop in to my head when i looked int eh first place stupid me.
If i drop the existing primary key and that is username will the database still work the same as befor and what is the sql to drop the existing primary key thanks for all your help.
No the database will not work the same. Everytime the script tries to use the "username", you will get error messages. You can use the username in your rating script, instead of creating a new field which I think will have the same value as the username has... Bye
The voting script uses ids iv tryed includeing their username but it does not work i think it is because ids only acepts numbers if im right. Iv worked away round useing that table iv made a new post in databases with alot more info here is the url to it. http://forums.digitalpoint.com/showthread.php?t=218575 Thanks for all your help every 1.