etsted Posted March 25, 2014 Share Posted March 25, 2014 this is a uploader script. in my phpmyadmin the image is stored in a type = blob. it works, the image is being uploaded to phpmyadmin, but i still get an error. 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 '1' at line 1 <?phpinclude "conn.php";$name = mysqli_real_escape_string($con, $_POST['name']);$details = mysqli_real_escape_string($con, $_POST['details']);$photo = addslashes(file_get_contents($_FILES['photo']['tmp_name']));$image = getimagesize($_FILES['photo']['tmp_name']);$imagetype = $image['mime'];echo "<br/>";$q = mysqli_query($con, "INSERT INTO animal VALUES('','$name','$details','$photo','$imagetype')") or die(mysqli_error($con));$r = mysqli_query($con, $q);if($r){ echo "information stored";}else{ echo mysqli_error($con);}?> Link to comment Share on other sites More sharing options...
thescientist Posted March 25, 2014 Share Posted March 25, 2014 because you execute the query twice, but the second time you pass a result object instead of a query as the second paramter. $q = mysqli_query($con, "INSERT INTO animal VALUES('','$name','$details','$photo','$imagetype')") or die(mysqli_error($con));$r = mysqli_query($con, $q); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now