duancha1065 2015-01-04 04:52
浏览 49
已采纳

SQL命令语法错误? [关闭]

I definitely regret asking such a simple question, but it's been driving me off the wall, and I'm not sure if it's because of an update or anything. But can anyone tell me what the error with the following SQL statement is?

$iname = mysql_query("SELECT * FROM calendarevents WHERE 'EventMonth'="January" AND 'EventDay'="1"")
or die(mysql_error());
  • 写回答

5条回答 默认 最新

  • douzhicong5965 2015-01-04 04:56
    关注

    This should work better, using correct quotes and backticks, please have a look at the query

    $iname = mysql_query("SELECT * FROM calendarevents WHERE `EventMonth`= 'January' AND `EventDay`= 1 ")
    

    SIDENOTE:

    Please consider using PDO or mysqli_ instead of mysql_* functions.

    This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?