0

I am trying to insert a new record into a mysql database and get the following 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 '30, 60, 90, DayCreated) VALUES ( 'Rush Shirt', '6-30-09','7-30-09','8-30-09','5-' at line 1

Using this code in php:

$sql = "INSERT INTO table_name ( FeeName, 30, 60, 90, DayCreated)
VALUES ( '$_POST[txtFee]', '$_POST[txt30]','$_POST[txt60]','$_POST[txt90]','$_POST[txtDayC]' )";

I searched the forums and the internet and couldn't find the correct syntax to fix this :(

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by nav33n
0

Well I found out that you cant have just numbers as column names.. So I changed that around and it worked..

Solution:

$sql = "INSERT INTO Admin ( FeeName, Day30, Day60, Day90, DayCreated) 
VALUES
( '".$_POST[txtFee]."', '".$_POST[txt30]."','".$_POST[txt60]."','".$_POST[txt90]."','".$_POST[txtDayC]."')";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.