Page 1 of 1

Unique User ID

Posted: Mon Aug 02, 2004 1:25 pm
by dwfait
Hi again. How would you run a query to find the largest number in a field, and then add a new row with that number + 1. (this number is the primary key).

Posted: Mon Aug 02, 2004 1:51 pm
by hawleyjr
Why don’t you just do an auto increment on the primary key?

Posted: Mon Aug 02, 2004 1:51 pm
by dwfait
i have, but i dont know how it works lol

Posted: Mon Aug 02, 2004 1:53 pm
by hawleyjr

Posted: Mon Aug 02, 2004 2:04 pm
by dwfait
Thanks, i get it now. Also, can someone show me an example and explanation of the mysql_query("INSERT INTO") command? as i dont fully understand that...

Posted: Mon Aug 02, 2004 2:16 pm
by John Cartwright

Code: Select all

<?

mysql_query("INSERT INTO `yourtable` SET username='john doe', email='john@doe.com'");

?>

Posted: Mon Aug 02, 2004 2:34 pm
by Draco_03
Go here
and after you can read this

Posted: Mon Aug 02, 2004 5:02 pm
by tim
phen, your command should use UPDATE TABLE

INSERT INTO table_name VALUES(" etc etc "

Posted: Mon Aug 02, 2004 5:08 pm
by dwfait
but that works just fine for me...

Posted: Mon Aug 02, 2004 5:19 pm
by tim
lol I guess its nothing to mention, its usually that syntax is better set-thru with the UPDATE command.

Correct me if i'm wrong.