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

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.