MDanz Posted January 6, 2011 Share Posted January 6, 2011 form <form action="<?php $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" method="post" ><input type="file" name="photo" value="" size="30" /><input type="submit" name="ssubmit" value="Submit" /></form> $tmpname = $_FILES['photo']['tmp_name']; $readphoto = fopen($tmpname, 'r'); $photo = fread($readphoto, filesize($tmpname)); $photo = addslashes($photo); fclose($readphoto); $query = "INSERT INTO student (PHOTO) ". "VALUES ('$photo')"; mysql_query($query) or die('Error, query failed.'); echo "Student information submitted."; i keep getting "Error, query failed"... what did i do wrong? Quote Link to comment Share on other sites More sharing options...
Zurev Posted January 6, 2011 Share Posted January 6, 2011 Change mysql_query($query) or die('Error, query failed.'); to mysql_query($query) or die (mysql_error()); And let us know what it says. Quote Link to comment Share on other sites More sharing options...
MDanz Posted January 6, 2011 Author Share Posted January 6, 2011 thx... it says "Column count doesn't match value count at row 1" ..do you know what that means? Quote Link to comment Share on other sites More sharing options...
MDanz Posted January 6, 2011 Author Share Posted January 6, 2011 4get found the problem.. thx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.