Solved

Need help with MySQL Query

Posted on 2009-05-15
3
309 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:jeffey48
3 Comments
 
LVL 28

Accepted Solution

by:
gamebits earned 250 total points
Comment Utility
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 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
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:jeffey48
Comment Utility
Had the query in 2 locations. Thanks for the quick responses!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now