xanie Posted January 21, 2013 Share Posted January 21, 2013 can u locate the error? thanks.. itcouldn't able to save photos on sql.. <?php if(isset($_POST['submit'])) { $title = $_POST['title']; $details = $_POST['details']; $month = $_POST['Month']; $day= $_POST['Day']; $year= $_POST['Year']; $date= "$month $day,$year"; $image=$_POST['image']; if(!empty($_FILES['image']['name'])) { $fileName = $_FILES['image']['name']; $tmpName = $_FILES['image']['tmp_name']; $fileSize = $_FILES['image']['size']; $fileType = $_FILES['image']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } } else { $content = "NULL"; $fileName = "NULL"; $fileType = "NULL"; } } mysql_query ("INSERT INTO newsandevents( date, details, title, photo, photo_name, photo_file_type ) VALUES( '$date', '$details', '$title' , '$content', '$fileName', '$fileType')") or die(mysql_error()); header('location:../News2.php'); print '<script type="text/javascript">'; print 'alert("Successfully added!")'; print '</script>'; ?> Link to comment https://forums.phpfreaks.com/topic/273419-unable-to-view-photo-in-sql-and-in-webpage/ Share on other sites More sharing options...
Muddy_Funster Posted January 21, 2013 Share Posted January 21, 2013 I'm not a big fan of online tests - for anything. If you actualy want help you will need to give a full and proper desciption of the problem whcih covers all aspects of what is going wrong as well as a description of each of the elements used in the process, such as the database column datatypes. any and all Error/Warning/Notice messages should also be included. Link to comment https://forums.phpfreaks.com/topic/273419-unable-to-view-photo-in-sql-and-in-webpage/#findComment-1407220 Share on other sites More sharing options...
xanie Posted January 22, 2013 Author Share Posted January 22, 2013 here is the problem sir, when i was uploading an image it appears in the sql as null, meaning it wasn't able to get the value of photo. Link to comment https://forums.phpfreaks.com/topic/273419-unable-to-view-photo-in-sql-and-in-webpage/#findComment-1407400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.