Im trying to upload a file to my database and am getting an error saying this:
Column count doesn't match value count at row 1
I have looked at the SQL statement and it lines up with what I have in the table. So I was wondering maybe it could be something to do with my php but am not sure where to look
Here is the php code:
<?php
include("database_vars.php");
$cust_equip = "SELECT ce_id, comp_name
FROM cust_equipment, company
WHERE company.comp_id = cust_equipment.comp_id";
$cust_result = mysql_query($cust_equip);
if(isset($_POST['stand_submit'])) {
$stand_id = $_POST['stand_id'];
$cust_equip = $_POST['cust_equip'];
$doc_type = $_POST['doc_type'];
$file_name = $_FILES['stand_doc']['name'];
$tmp_name = $_FILES['stand_doc']['tmp_name'];
$file_size = $_FILES['stand_doc']['size'];
$file_type = $_FILES['stand_doc']['type'];
$fp = fopen($tmp_name, 'r');
$content = fread($fp, $file_size);
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc()) {
$file_name = addslashes($file_name);
}
$insert_query = "INSERT INTO standards(st_id, ce_id, st_type, st_file_name, st_file_type, st_file_size, st_file)
VALUES('$stand_id', '$cust_equip', '$doc_type', '$file_name', '$file_type' '$file_size', '$content')";
$insert_result = mysql_query($insert_query) or die('Error, query failed ' . mysql_error());
echo "<br />File " . $file_name . "uploaded<br />";
}
?>
and here is the form that puts data into the database:
<form action="" enctype="multipart/form-data" method="post" >
<p>Standard Procedure ID: <input type="text" name="stand_id" /></p>
<p>Customer: <select name="cust_equip">
<?php while($cust_array = mysql_fetch_array($cust_result)) {
echo "<option value='" . $cust_array[ce_id] . "'>" . $cust_array[comp_name] . "</option>\n";
}?>
</select></p>
<p>Document Type: <select name="doc_type">
<option>Drawing</option>
<option>CheckSheet</option>
<option>Manual</option>
<option>Estimating Document</option>
</select></p>
<p>Document: <input type="hidden" name="MAX_FILE_SIZE" value="2000000" /><input type="file" name="stand_doc" size="50" /></p>
<p><input type="submit" name="stand_submit" value="Submit" /></p>
</form>
So is there anything wrong with my code or is the file just not being uploaded?