當我嘗試和我的數據庫運行此查詢:PHP的SQL命令只是清除數據庫表?
$mysqli->query("UPDATE
catalogsearch_fulltext
SET data_index = '".$unique_string."'
WHERE MATCH(data_index) AGAINST ('".$savestring."')
AND store_id = '1'");
它不但不工作,但它會清除我的整個catalogsearch_fulltext
表。我究竟做錯了什麼?我對SQL有些陌生,所以希望有人能夠發現一個快速錯誤。
如果需要,我可以提供更多的代碼,但我認爲它不適用。
謝謝!
編輯:
$unique_string = "325-FBA-BA-0006-x3|Badger|Enabled|Taxable Goods|Badger - SPF 30+ Anti-Bug Sunscreen, 2.9oz. - (Pack of 3)|47300|You asked, and Badger listened! After receiving many requests for a totally natural combination bug repellent and sunscreen, Badger took their wildly popular SPF 30+ Sunscreen formula and combined it with their Anti-Bug Balm formula to create easy-to-apply, safe, and natural protection for the whole family!|43.35|1"
$string = "the same as above but with duplicat entries in the | Pipe | sections."
這也是值得注意的是,這個查詢是一個循環,經過約6條去。
$ unique_string和$ savestring的值是多少? – kieran
$ unique_string和$ savestring非常長,但我會將它們的值添加到文章 –
更新不應該刪除記錄,除非您有一個奇怪的外鍵設置或某種注入漏洞。 –