Solved

Need help with MySQL Query

Posted on 2009-05-15
3
315 Views
Last Modified: 2012-05-07
When I run this query on my local machine it runs fine. When I place it on my live server I get the following error???

Error updating site: INSERT INTO tblque (EventID, EventDate, EventTime) VALUES ('258', '2009-05-15', '22:00:00) MySQL Said : 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 ''22:00:00)' at line 4

I know exactly what it says but the code looks ok
$strSQL = "INSERT INTO tblque (EventID, EventDate, EventTime) VALUES ('$EventID', '" . date('Y-m-d', strtotime($EventDate)) . "', '" . date('H:i:s', strtotime($rEventStartTime)) . "')"; 
		if ($debug) echo "<br>Line 95 - INSERT INTO tblque - $strSQL<br>";
		$result = mysql_query($strSQL) or die ('Database error: ' . $strSQL . "\n" . 'MySQL Said : '. mysql_error());

Open in new window

0
Comment
Question by:Jeff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Accepted Solution

by:
gamebits earned 250 total points
ID: 24400368
INSERT INTO tblque (EventID, EventDate, EventTime) VALUES ('258', '2009-05-15', '22:00:00)

should be

 INSERT INTO tblque (EventID, EventDate, EventTime) VALUES ('258', '2009-05-15', '22:00:00')

missing quote before )
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 24400378
the error message does not match the code ...
the error shows a missing ' after the time, resp a 2 single quotes before the time. ...
0
 

Author Comment

by:Jeff
ID: 24400473
Had the query in 2 locations. Thanks for the quick responses!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question