![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
Problem inserting data into database
Hi there ppl.
I am getting an error when i try put data into my database using; if(isset($_POST['confirm']))
{
$subject2 = $_SESSION['subject'];
$priority2 = $_SESSION['priority'];
$description2 = $_SESSION['description'];
$type2 = $_SESSION['type'];
$time2 = date('l dS \of F Y h:i:s A');
echo $time2;
echo"$id";
$time2="33";
include '../connect.php';
$query = "INSERT INTO case VALUES ('','$id','$priority2','$subject2','$description2','$type2','$time2')";
$result = mysql_query($query)or die (mysql_error()."product query");
mysql_close();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 'case VALUES ('','30','High','ewrkjh','kjh','Problem','33')' at product query Any help??? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
what is the table description? Are you putting a string into an integer field?
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4
![]() |
Ive fixed it.
Case apparently is some keyword in mysql - i used `case` and bingo! |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
'Case' is a keyword lots of places (remember switch statements, and even a tractor company I useta know?), best to avoid those types of words and check keyword lists if you think you might need to.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
Glad you got it worked out... yes, it is a very good idea to check keyword lists when in doubt.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|