Jump to content

Help with mySQL INSERT INTO syntax error


jcjst21

Recommended Posts

Hello,

 

I receive an error when i submit my form for processing:

 

it says:

 

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) VALUES ('' at line 1

 

i can't figure out what's wrong with my code; it looks right to me:

 

<?php

$hcTime=$_POST['scheduleTime'];
$group=$_POST['groupToCall'];
$sunday=$_POST['Sunday'];
$monday=$_POST['Monday'];
$tuesday=$_POST['Tuesday'];
$wednesday=$_POST['Wednesday'];
$thursday=$_POST['Thursday'];
$friday=$_POST['Friday'];
$saturday=$_POST['Saturday'];

if(isset($_POST['scheduleTime']))
{

$sql="INSERT INTO HealthCenterSchedule(time, group, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday) VALUES ('$hcTime', '$group', '$sunday', '$monday', '$tuesday', '$wednesday', '$thursday', '$friday', '$saturday')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  echo $sql;
  }
$result = mysql_query("SELECT * FROM HealthCenterSchedule");
}

?>

 

Could someone take a look at this and see if I'm not seeing something.

 

Thanks,

jcjst21

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.