In your database, make the ID column AUTO_INCREMENT, and then simply don't specify a value for it when you insert.
----- Original Message ----- From: "will hives" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 24, 2002 11:43 AM Subject: [PHP] Increment help..please > please help I'm a newb and this is really messing with my head. All I want > to know is what do I need to add to this script to allow it to increment the > ID number..... pleaseeeeee. > thank you very much for a simple boy!!!! > > Will > <? > > $db_name = "altone"; > > $table_name = "author"; > > > > $connection = @mysql_connect("www.myserver.net", "test", "will") or die > ("couldn't connect."); > > $db = @mysql_select_db($db_name, $connection) or die ("couldn't select > database."); > > $sql = "INSERT INTO $table_name (id, name, email, picture_name) > VALUES ('$id', '$name', '$email', '$picture_name') "; > > $result = @mysql_query($sql, $connection) or die ("couldn't execute query"); > > > > > > if ($picture != "") { > > > move_uploaded_file($picture, "/home/mine/yep/php/$picture_name"); > > > } > > > > > ?> > > > <html> > <head> > <title>my contact management system: add a contact</title> > </head> > <body> > > <table cellspace=3 cellpadding=5> > <tr> > <th>Name & email information</th> > <th> </th> > </tr> > <tr> > <td valign=top> > > <p><stong><font size="-2" face="Verdana, Arial, Helvetica, > sans-serif">name:</font><br> > <? echo "$table_name"; ?><br> > <? echo "$name"; ?><br> > <? echo "$id"; ?> > </p> > <p><stong><font size="-2" face="Verdana, Arial, Helvetica, > sans-serif">email:</font><br><? echo "$email"; ?> > > <br> > </p> > <font size="-2" face="Verdana, Arial, Helvetica, sans-serif">File > to Upload:</font><br> > <img src=<? echo "http://www.myserver.net/php/$picture_name"; ?>> > <p><stong></p> > </td> > <td valign=top> </td> > </tr> > <tr> > <td align=center colspan=2> > <div align="left"><br> > </div> > <p align="left"> > <input type="submit" name="submit" value="add to contact system"> > </p> > <div align="left"></div> > </td> > </tr> > </table> > </body> > </html> > > > Cheers > Will > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]