user656521
user656521

Reputation:

Error occurred during SQL insertion

I have tried this code to send a file and insert the details about the mail to a table:

<?php
session_start();
define('incall', true);
include("connection.php");

if(!@include_once('config.php'))
{
    header('HTTP/1.0 404 Not Found');
    exit;
}

$to=$_POST['to'];
$message    = str_replace('{link}', $download_path.$_POST['filename'].'.mp3', $email_body);
$headers  = "From: ".$_POST['from'];
$subject=$_POST['subject'];
$date=date("Y/m/d");
$size='';
$username=$_SESSION['username']
if(mail($to, $subject, $message, $headers))
{   
    $query=mysql_query("INSERT INTO sent values('$username', '$to','$date', '', '.mp3', '$size' )");
    header("location:mailsent.php");
}
else
    exit('Error! VoiceMail not be send.');
?>

But I got some errors saying:

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

Please help me

Upvotes: 0

Views: 124

Answers (1)

Gaurav
Gaurav

Reputation: 28755

$username=$_SESSION['username'] missing semicolon here

Filesize :

use filesize($_FILE['uploaderName']['tmp_name']);

Upvotes: 2

Related Questions