I have modified the "storing binary data to a database" code found on this website, but I haven't been able to get in contact with the code writer, so I am asking people for help!
Everytime I press submit it comes back with, "This file is stored in the database with an ID: 0" and it doesn't add anything to the database, please have a look at the code:
<?php
// store.php3 - by Florian Dittmer <dittmer@gmx.net>
// Example php script to demonstrate the storing of binary files into
// an sql database. More information can be found at http://www.phpbuilder.com/
?>
<HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
<BODY>
<?php
// code that will be executed if the form has been submitted:
if ($submit) {
// connect to the database
// (you may have to adjust the hostname,username or password)
$username = "ccfilmswebsite";
$password = "43erbc48";
$host = "localhost";
$database = "play";
mysql_connect($host,$username,$password) or die("Cannot connect to the database.<br>" . mysql_error());
mysql_select_db($database) or die("Cannot select the database.<br>" . mysql_error());
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=MYSQL_QUERY("INSERT INTO vmplay (description,bin_data,filename,filesize,filetype,author,cat,headline,date,fulldate,special,source,shortnews,fullnews,videourllow,videourlmed,videourlhigh,artistinfo) ".
"VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type','$author','$cat','$headline','$date','$fulldate','$special','$source','$shortnews','$fullnews','$videourllow','$videourlmed','$videourlhigh','$artistinfo')");
$id= mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
} else {
// else show the form to submit new data:
?>
<div align="center">
<div align="center">
<form method="get" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<table width="720" border="0" cellspacing="0" cellpadding=0 >
<tr>
<td height="108" width=682 valign="top" bgcolor="#333333">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="60" bgcolor="#333333">
<tr>
<td height="89" width="201" valign="bottom" bgcolor="#333333"> <a href="http://www.vm-play.net" target="_parent"><img src="assests/gfx/logo.gif" width="200" height="89" border="0" alt="Home"></a>
</td>
<td width="482"></td>
</tr>
</table>
</td>
<td width="38"></td>
</tr>
<tr>
<td height="1562" colspan="2" valign="top" align="center">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000">
<tr>
<th width="316" height="58"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Type your Name here:<br>
</font></th>
<th width="565">
<input type="text" name="author" size="40" value="Daniel Halawi">
</th>
</tr>
<tr>
<th bgcolor="#FF9900" height="58"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Choose Category<br>
</font></th>
<th bgcolor="#FF9900">
<select name="cat" size="1">
<option selected>latest News</option>
<option>ex</option>
<option>music</option>
<option>movies</option>
<option>interact</option>
<option>win</option>
<option>staff news</option>
<option>music video</option>
</select>
</th>
</tr>
<tr>
<th bgcolor="#FF9900" height="58"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Type Headline<br>
</font></th>
<th bgcolor="#FF9900">
<input type="text" name="headline" size="40">
</th>
</tr>
<tr>
<th height="58"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Special (if any)<br>
</font></th>
<th>
<input type="text" name="special" size="40">
</th>
</tr>
<tr>
<th height="58"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Source (if any)<br>
</font></th>
<th>
<input type="text" name="source" size="40" value="vm-play.net">
</th>
</tr>
<tr>
<th height="76" bgcolor="#CC0000"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
<font color="#FFFFFF">Frontpage Date (don't change)</font><br>
</font></th>
<th bgcolor="#CC0000">
<input type="text" name="date" value="<?php
echo ''.date('d M');
echo '';
?>
" size="40">
</th>
</tr>
<tr>
<th bgcolor="#CC0000" height="76"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
<font color="#FFFFFF">Hidden Date (don't change)</font><br>
</font></th>
<th bgcolor="#CC0000">
<input type="text" name="fulldate" value="<?php
echo ''.date('Y-m-d G:i:s');
echo '';
?>
" size="40">
</th>
</tr>
<tr>
<th bgcolor="#FF9900" height="173"><font face="Verdana, Arial, Helvetica, sans-serif">Your
News in short</font></th>
<th bgcolor="#FF9900">
<textarea name="shortnews" rows=10 cols=40 WRAP>
</textarea>
</th>
</tr>
<tr>
<th bgcolor="#FF9900" height="173"><font face="Verdana, Arial, Helvetica, sans-serif">Your
News in full</font></th>
<th bgcolor="#FF9900">
<textarea name="fullnews" rows=10 cols=40 WRAP>
</textarea>
</th>
</tr>
<tr>
<th height="58"><br>
<font face="Verdana, Arial, Helvetica, sans-serif">File Description:<br>
</font></th>
<th>
<input type="text" name="form_description" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
</th>
</tr>
<tr>
<th height="54"><font face="Verdana, Arial, Helvetica, sans-serif">File
to upload/store in database:</font></th>
<th><br>
<input type="file" name="form_data" size="40">
</th>
</tr>
<tr>
<th colspan="2" height="59" valign="top"><br>
This section of the upload is for music videos, leave this areas
with the default (empty) if there isn't an url to put it</th>
</tr>
<tr>
<th height="94" bgcolor="#33CCFF">
<p><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Windows Media URL - LOW</font></p>
<p> </p>
</th>
<th bgcolor="#33CCFF">
<input type="text" name="videourllow" size="40" value="empty">
</th>
</tr>
<tr>
<th bgcolor="#33CCFF" height="76"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Windows Media URL - MED<br>
</font></th>
<th bgcolor="#33CCFF">
<input type="text" name="videourlmed" size="40" value="empty">
</th>
</tr>
<tr>
<th bgcolor="#33CCFF" height="76"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Windows Media URL - HIGH<br>
</font></th>
<th bgcolor="#33CCFF">
<input type="text" name="videourlhigh" size="40" value="empty">
</th>
</tr>
<tr>
<th bgcolor="#33CCFF" height="21"><font face="Verdana, Arial, Helvetica, sans-serif">Real
Media URL - LOW</font></th>
<th bgcolor="#33CCFF"> NOT YET AVALIABLE</th>
</tr>
<tr>
<th bgcolor="#33CCFF" height="21"><font face="Verdana, Arial, Helvetica, sans-serif">Real
Media URL - MED</font></th>
<th bgcolor="#33CCFF">NOT YET AVALIABLE </th>
</tr>
<tr>
<th bgcolor="#33CCFF" height="21"><font face="Verdana, Arial, Helvetica, sans-serif">Real
Media URL - HIGH</font></th>
<th bgcolor="#33CCFF">NOT YET AVALIABLE </th>
</tr>
<tr>
<th bgcolor="#33CCFF" height="38"><font face="Verdana, Arial, Helvetica, sans-serif">Real
Media URL - SURESTREAM</font></th>
<th bgcolor="#33CCFF">NOT YET AVALIABLE </th>
</tr>
<tr>
<th height="58" valign="top" bgcolor="#33CCFF"><font face="Verdana, Arial, Helvetica, sans-serif"><br>
Artist Info:<br>
</font></th>
<th valign="middle" bgcolor="#33CCFF" align="center">
<div align="center">
<input type="text" name="artistinfo" size="40">
</div>
</th>
</tr>
<tr>
<th height="73" colspan="2" valign="top">
<p> </p>
<p>
<input type="submit" name="submit" value="submit">
<input type="reset" name="Reset" value="reset">
</p>
</th>
</tr>
</table>
</td>
</tr>
<tr>
<td height="35"></td>
<td></td>
</tr>
<tr>
<td height="1"><img height="1" width="682" src="/assests/gfx/spacer.gif"></td>
<td></td>
</tr>
</table></form>
</div>
<?php
}
?>
</div>
</BODY>