Jump to content

unable to view photo in sql and in webpage


xanie

Recommended Posts

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>';
?>

Edited by xanie
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.