mysql_insert_id(); question
Posted: Sat Apr 26, 2003 1:31 am
I have a script that is using mysql_insert_id(); but my problem is it is performing this on load and on submit....
how can I get the script to perform this function but once?
Here is the code....
Then it goes on to display the info updated....
Should I post to another page?
As for the post here is the form action....
Thanks all...
how can I get the script to perform this function but once?
Here is the code....
Code: Select all
sqlquery = "INSERT INTO $table
VALUES('$id','$update','$directory','$description')";
mysql_query($sqlquery);
$id = mysql_insert_id();
if ($submit){Should I post to another page?
As for the post here is the form action....
Code: Select all
<form method=post enctype="multipart/form-data">
<input=hidden name="id" value="NULL">
File Name:<br>
<input type=text name="update"><br>
<input type=hidden name="directory" value="<?php echo $dir?>">
Image:<br>
<input type=file name=pic><br>
Description:<br>
<textarea cols="25" rows="5" name="description"></textarea><br>
<input type=submit name=submit value="upload image">