I did that with this script and it works fine, but the reason I am doing it
is so I can then give the image which is uploaded the story ID. But for some
reason I can't get it to work... here is the auto_increment script any ideas
of how to add the ID to the image?????? I would be very great ful if you
could amend the script (as I am a newb I can work things out once they have
been done if that makes any sense)
cheers will
<?
$db_name = "main";
$table_name = "main";
$connection = @mysql_connect("www.main.net", "main", "main") 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/main/main/main/$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"; ?>
<? echo "$name"; ?>
</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.main.net/images/$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>
in article 004501c1a511$642b4930$a023b1cf@win2k, Tyler Longren at
[EMAIL PROTECTED] wrote on 24/1/02 7:57 pm:
> Why don't you just set auto_increment on the id field in the database table?
>
> Tyler
>
> ----- Original Message -----
> From: "will hives" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, January 24, 2002 1: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]