grlayouts Posted June 23, 2007 Share Posted June 23, 2007 the code i have uploads the file ok but it's not placing the images location into the database. the error i get is Could not update database". but i cant see the problem? move_uploaded_file($_FILES["file"]["tmp_name"], 'uploads/'. $_FILES["file"]["name"] .''); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; print '<p>'.$type.'</p>'; $fileName = $_FILES['file']['name']; mysql_query("insert into images (user, image) values('$stat[id]','$fileName')") or die("Could not update database."); } } } Link to comment https://forums.phpfreaks.com/topic/56871-solved-upload-problem/ Share on other sites More sharing options...
chigley Posted June 23, 2007 Share Posted June 23, 2007 For starters, where do you define $stat[id]? <?php move_uploaded_file($_FILES["file"]["tmp_name"], 'uploads/'. $_FILES["file"]["name"] .''); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; print '<p>'.$type.'</p>'; $fileName = $_FILES['file']['name']; mysql_query("insert into images (user, image) values('$stat[id]','$fileName')") or die("Could not update database: ".mysql_error()); } } } ?> Run that and see what the mySQL error is. Link to comment https://forums.phpfreaks.com/topic/56871-solved-upload-problem/#findComment-280983 Share on other sites More sharing options...
grlayouts Posted June 23, 2007 Author Share Posted June 23, 2007 sorry i had update user instead of ID.. thanks alot though. Link to comment https://forums.phpfreaks.com/topic/56871-solved-upload-problem/#findComment-280987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.