<input type="checkbox" name="CBage" id="cbage2" value="and age >= 18 and age <= 24" checked/><label for="cbage2">18-24</label>
值= 「和年齡> = 18和年齡< = 24」
在PHP後動作(我已經嘗試)後
$age1 = $_POST['CBage'];
$age = mysql_real_escape_string(implode(",", $age1));
或
$age = implode(",", $age1);
表作爲
CREATE TABLE `jobs` (
`age` varchar(200) COLLATE utf8_unicode_ci
)ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
在MySQL創建它插入作爲
INSERT INTO jobs VALUES ('$age')
插入作爲該值如下
and age = 18 and age,and age = 25 and age,
的問題是,它不正確插入的值(其缺少> <和一些文字在最後)
"and age >= 18 and age <= 24" but rather it inserted as "and age = 18 and age,and age = 25 and age,"
的(http://stackoverflow.com/questions/2843849/mysql-real-escape-more-than-once)嘗試使用ヶ輛() –
沒有它不是」可能重複t錯過了那些角色;你看着網頁瀏覽器中的值,它將它們視爲HTML標記中的特殊字符....做一個「查看源代碼」來查看數據庫中真正檢索的內容 –
確定首先,使用mysql_代替使用PDO或MYSQLI。嘗試粘貼一個完整的代碼,以幫助更好地瞭解您的問題 –