所以我試圖提前24小時以上返回所有約會。我是積極的代碼中的錯誤是圍繞DATE_ADD的東西,所以我知道PHP變量設置正確。我想我只是在想DATE_ADD錯誤。我也嘗試過幾種方法,沒有運氣。只需CURDATE()的作品。謝謝你的幫助!使用DATE_ADD時出現SQL語法錯誤()
$sql = " SELECT DISTINCT timeBlocks.date
FROM timeBlocks
WHERE timeBlocks.location = '".$appointmentLocation."' AND timeBlocks.school = '".$_SESSION["school"]."' AND timeBlocks.date >= DATE_ADD(curdate(), INTERVAL 1 YEAR)
ORDER BY timeBlocks.date ASC;";
我的經驗告訴我,使用** [HEREDOC](http://il.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)**多行字符串的語法更好。 –
謝謝!我現在將通讀這一點。 – radleybobins
https://gist.github.com/2553439 <<您的查詢的示例用法。 –