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? Link to comment https://forums.phpfreaks.com/topic/223580-upload-image-not-working/ 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. Link to comment https://forums.phpfreaks.com/topic/223580-upload-image-not-working/#findComment-1155702 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? Link to comment https://forums.phpfreaks.com/topic/223580-upload-image-not-working/#findComment-1155703 Share on other sites More sharing options...
MDanz Posted January 6, 2011 Author Share Posted January 6, 2011 4get found the problem.. thx Link to comment https://forums.phpfreaks.com/topic/223580-upload-image-not-working/#findComment-1155704 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.