私は自分の php スクリプトで mysql を 6 年以上使用していますが、このようなエラーに遭遇したことはありません。
このSQLコマンドを実行すると:
SELECT `discount_items`.* FROM `discount_items` WHERE (position=1) AND (active=1) AND (end<=1344007212) AND (show=1) LIMIT 1
それは私にこのエラーを投げます
#1064 - 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 'show=1) LIMIT 1' at line 1
テーブル構造は次のとおりです。
CREATE TABLE IF NOT EXISTS `discount_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
`image` text CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
`discount` float NOT NULL,
`price1` float NOT NULL,
`price2` float NOT NULL,
`bought` int(11) NOT NULL,
`target` int(11) NOT NULL,
`desc` text CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
`link` text CHARACTER SET utf8 COLLATE utf8_czech_ci NOT NULL,
`active` tinyint(1) NOT NULL,
`start` int(11) NOT NULL,
`end` int(11) NOT NULL,
`position` int(11) NOT NULL DEFAULT '1',
`show` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
何が悪いのかわかりません。明らかに「表示」フィールドが問題の原因ですが、私はすでにすべてを試しました..(表示フィールドに何か問題があるに違いありません:
SELECT `discount_items`.* FROM `discount_items` WHERE (show=1) AND (active=1) AND (end<=1344007212) AND (position=1) LIMIT 1
スロー
#1064 - 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 'show=1) AND (active=1) AND (end<=1344007212) AND (position=1) LIMIT 1' at line 1
したがって、問題は show フィールドとともに移動します。
これが一般的な問題である場合は申し訳ありませんが、グーグルで検索しても何も見つかりませんでした。このエラーはグローバルすぎて、私には何も説明しません。
助けとヒントをありがとう!