Stevis2002 Posted December 8, 2010 Author Share Posted December 8, 2010 nothing gets entered into the url field in the database, just NULL.. That's because the code you put in does not have or set any value for that field in the database. Someone has suggested twice in this thread that you need to define how you are going to store multiple images and associate them with the correct information in the database. The sample code I posted did associate the multiple files with the id in the database by including the id as part of the file name. If you want something different than that method, you will need to define it and then write the code to accomplish it. Hi mate, How much would you charge just to finish this script off for me so it uploads multiple images, and stores url&image info in db? I think i will be able to manage to get the info back out ok and disply the image(s) Cheers, Steve Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted December 8, 2010 Author Share Posted December 8, 2010 nothing gets entered into the url field in the database, just NULL.. That's because the code you put in does not have or set any value for that field in the database. Someone has suggested twice in this thread that you need to define how you are going to store multiple images and associate them with the correct information in the database. The sample code I posted did associate the multiple files with the id in the database by including the id as part of the file name. If you want something different than that method, you will need to define it and then write the code to accomplish it. Hi mate, How much would you charge just to finish this script off for me so it uploads multiple images, and stores url&image info in db? I think i will be able to manage to get the info back out ok and disply the image(s) Cheers, Steve Aimed at PFMaBiSmAd BTW lol Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted December 9, 2010 Author Share Posted December 9, 2010 Can anybody help me anymore then please because i am really stuck now Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted December 12, 2010 Author Share Posted December 12, 2010 If anybody can help me just get this script working then it would be very much ppreciated, as i will be able to do the rest myself then. Thanks all Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted December 13, 2010 Author Share Posted December 13, 2010 Ok, thanks for all of your help anyway. I will have to try and adjust the script to try and work for single uploads again Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted December 13, 2010 Author Share Posted December 13, 2010 All these views on this topic makes me think that others also struggle with this, so if somebody could modify my script too work, and tell me how much it would cost, then i will give the finished script out to anyone who wants it. Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted December 13, 2010 Author Share Posted December 13, 2010 Ok, So now i have altered the way i am dealing with images to try and make it easier for me to get working, but it is not uploading file to server, or file info to db. I have made the extra db fields, pic1, pic2 etc, but nothing is getting there if(isset($_POST['submit'])) { $customername = $_POST['customername']; $imagename = $_POST['imagename']; $testimonial = $_POST['testimonial']; $sort_order = $_POST['sortorder']; $town = $_POST['town']; $uploaddir = 'uploaded_images/'; $uploadfile = $uploaddir . basename($_FILES['ipic1']['imagename']); echo($_FILES['ipic1']['type']); move_uploaded_file($_FILES['ipic1']['tmp_name'], $uploadfile); $pic1 = $_FILES['ipic1']['imagename']; $uploaddir2 = 'uploaded_images/'; $uploadfile2 = $uploaddir2 . basename($_FILES['ipic2']['imagename']); echo($_FILES['ipic2']['type']); move_uploaded_file($_FILES['ipic2']['tmp_name'], $uploadfile2); $pic2 = $_FILES['ipic2']['imagename']; $uploaddir3 = 'uploaded_images/'; $uploadfile3 = $uploaddir3 . basename($_FILES['ipic3']['imagename']); echo($_FILES['ipic3']['type']); move_uploaded_file($_FILES['ipic3']['tmp_name'], $uploadfile3); $pic3 = $_FILES['ipic3']['imagename']; $uploaddir4 = 'uploaded_images/'; $uploadfile4 = $uploaddir4 . basename($_FILES['ipic4']['imagename']); echo($_FILES['ipic4']['type']); move_uploaded_file($_FILES['ipic4']['tmp_name'], $uploadfile4); $pic4 = $_FILES['ipic4']['imagename']; $uploaddir5 = 'uploaded_images/'; $uploadfile5 = $uploaddir5 . basename($_FILES['ipic5']['imagename']); echo($_FILES['ipic5']['type']); move_uploaded_file($_FILES['ipic5']['tmp_name'], $uploadfile5); $pic5 = $_FILES['ipic5']['imagename']; $query=sprintf("INSERT INTO testimonials (CustomerName, Town, Testimonial, SortOrder, pic1, pic2, pic3, pic4, pic5) VALUES ('$customername','$town','&testimonial','$sort_order','$pic1','$pic2','$pic3','$pic4','$pic5')", mysql_real_escape_string($_POST['customername']), mysql_real_escape_string($_POST['town']), mysql_real_escape_string($_POST['testimonial']), mysql_real_escape_string($_POST['sort_order']), mysql_real_escape_string($_POST['pic1']), mysql_real_escape_string($_POST['pic2']), mysql_real_escape_string($_POST['pic3']), mysql_real_escape_string($_POST['pic4']), mysql_real_escape_string($_POST['pic5']) ); mysql_query($query) or die('Error, insert query failed, could not connect to database'); echo "New testimonial added \n"; } ?> <form action="" method="post" enctype="multipart/form-data" name="add_test" id="add_test"> <p> </p> <p align="center"> <label for="customername">Customer Name:</label> <input name="customername" type="text" id="customername" maxlength="150" value="<?php echo $_POST['customername']; ?>" /> </p> <p align="center"> <label for="town">Town/City: </label> <input name="town" type="text" id="town" maxlength="150" value="<?php echo $_POST['town']; ?>" /> </p> <p align="center"> <label for="testimonial"><u>Testimonial </u></label> </p> <p align="center"> <textarea name="testimonial" id="testimonial" cols="60" rows="10"><?php echo $_POST['testimonial']; ?></textarea> </p> <p align="center"> <label for="sort_order">Sort Order: </label> <input name="sort_order" type="text" id="sort_order" size="10" maxlength="3" value="<?php echo $_POST['sort_order']; ?>" /> </p> <p align="center"> <input type="hidden" name="MAX_FILE_SIZE" value="500000" /> <input type="file" name="ipic1" /><br /> <input type="file" name="ipic2" /><br /> <input type="file" name="ipic3" /><br /> <input type="file" name="ipic4" /><br /> <input type="file" name="ipic5" /> </p> <p align="center"> <input type="submit" name="submit" id="submit" value="Submit" /> </p> <p> </p> <p> </p> </form> </html> 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.