Solved

Need help with MySQL Query

Posted on 2009-05-15
3
312 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
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 142

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

805 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