I want to insert an image into my database(mysql). The script I am using is from one of the tutorials on thi site. The problem is that the data is not inserting. There's an auto_increment id in the table and it always comes back as "0" The image does not insert into the database. Anyone see why? Others have the same problem with this script. Thanks in advance for any help.
<?
if ($submit){
mysql_pconnect ("mysql.mysite.com", "user", "password")
or die ("Could not connect to database");
mysql_select_db("database") or
die ("Could not select database");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=mysql_query ("insert into binary_data (description, bin_data, filename, filesize, filetype)"." values ('$form_description', '$data', '$form_data_name', $form_data_size', '$form_data_type')");
$id=mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
mysql_close();
}else{
?>
<form method="post" action="<?php echo $php_self; ?>" enctype="multipart/form-data".
File Description:<br>
<input type="text" name="form_description" size = "40">
<input type="hidden" name= "max_file_size" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size"40">
<p><input type="submit" name="submit" value="submit">
</form>
<?
}
?>