?
Solved

Need help with MySQL Query

Posted on 2009-05-15
3
Medium Priority
?
322 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 1000 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 1000 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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

771 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