MySQL Forums
Forum List  »  PHP

sql Quotes problem
Posted by: phil speakman
Date: April 27, 2005 04:00AM

Performing a relatively simple database search with this line

$sql = "SELECT MAX(end_time) AS end_time FROM $table WHERE date = $date";

When i execute this i get no results, when i execute it in phpMyAdmin with the variables hardcoded

SELECT MAX(end_time) AS end_time FROM PhilS_timesheets WHERE date ='2005-04-27'

(and with the date in single quotes) i get the correct answer, how can i achieve the same results with variables?

thanks in advance, Phil

Options: ReplyQuote

Written By
sql Quotes problem
April 27, 2005 04:00AM
April 28, 2005 06:34AM
April 28, 2005 08:47PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.