All you need to do is the set the field type for the id similar to :

ID smallint not null primary key auto_increment

you do not need to refer to ID in your insert statement.

/dkm

----- Original Message -----
From: "will hives" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 24, 2002 2:43 PM
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]

Reply via email to