Jump to content

Error: Query was empty


Cooper94

Recommended Posts

I get a error that is:

 

Error: Query was empty

 

Any help will be greatful, code is on the bottom and thank you again for your help guys!

 

<?php if(isset($_POST['contact'])) { 
include 'db.php';

$name = $_POST['name'];
$email = $_POST['email'];
$to = $_POST['to'];
$comments = $_POST['comments'];
$today = date("Y-m-d");

$name = mysql_real_escape_string($name);
$email = mysql_real_escape_string($email);
$to = mysql_real_escape_string($to);
$comments = mysql_real_escape_string($comments);

$sql=mysql_query("INSERT INTO contact (from,date,to,comments,email)
VALUES
('$name','$today','$to','$comments','$email')");


if (!mysql_query($sql,$connection))
  {
  die('Error: ' . mysql_error());
  }

}
?>

Link to comment
https://forums.phpfreaks.com/topic/174737-error-query-was-empty/
Share on other sites

Archived

This topic is now archived and is 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.