?
Solved

Need help with MySQL Query

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

650 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