Babar Junaid Babar Junaid - 1 year ago 57
HTML Question

There is some error in my SQL query for inserting image to MySQL database

I have an error in my SQL query for inserting image in database of MySQL.

When I try to save image error occur in SQL query for inserting image. The error is this

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2( .?/279<<

<!DOCTYPE html>

<form action="http://localhost/upload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="image" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">

mysql_connect("localhost","root","") or die("not conected");
mysql_select_db("image") or die("not selected");

$q="INSERT INTO imagee(image_id,image_name,image)
mysql_query($q) or die(mysql_error());

Answer Source

<form action="phpfilename.php" method="post" 

<input  type="file" name="file" id="file" />	
<input type="submit" value="Upload Image" name="submit">



$result=mysql_query("insert into tablename(dbfieldname) values('$dest')");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download