Jump to content

Parse error:syntax error,unexpected if (T_IF)


Recommended Posts

<?php

include('../config/db.php')

 

 

 

if(isset($_POST['submit']))

{

$title = $_POST['title'];

$details = $_POST['details'];

$date = $_POST['date_from'];

$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";

}

cdv

 

$date = date('Y-m-d', strtotime($date)); // outputs 2006-01-24

 

mysql_query("INSERT INTO newsandevents (date, details, title, photo, photo_name, photo_file_type)

VALUES (''Now(), '$ddetails', '$title' ,'$content', '$fileName', '$fileType')") or die(mysql_error());

 

header('location:News.php');

 

}

 

print '<script type="text/javascript">';

print 'alert("Successfully added!")';

print '</script>';

 

 

?>

 

thanks..

<?php
include('../config/db.php');




if(isset($_POST['submit']))
{
$title  = $_POST['title'];
$details = $_POST['details'];
$date  = $_POST['date_from'];
$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";
}
cdv


$date  =  date('Y-m-d', strtotime($date)); // outputs 2006-01-24  


mysql_query("INSERT INTO newsandevents (date, details, title, photo, photo_name, photo_file_type)
VALUES (''Now(), '$ddetails', '$title' ,'$content', '$fileName', '$fileType')") or die(mysql_error());


header('location:News.php');


}


print '<script type="text/javascript">';
print 'alert("Successfully added!")';
print '</script>'; 



?>

Are you showing us working code for reference, or asking for more help? If you are showing us working code, saying so would be nice, and you should mark the topic 'solved'. If you are asking for more help, then showing us a bunch of code without any errors or comments isn't going to get you any help.

Are you showing us working code for reference, or asking for more help? If you are showing us working code, saying so would be nice, and you should mark the topic 'solved'. If you are asking for more help, then showing us a bunch of code without any errors or comments isn't going to get you any help.

i'm asking for help. Someone told me to post the whole code and i forgot to put some comment on it.

Guest
This topic is now closed to further replies.
×
×
  • 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.