2011-08-19 47 views
0

当我尝试和我的数据库运行此查询: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条去。

+0

$ unique_string和$ savestring的值是多少? – kieran

+0

$ unique_string和$ savestring非常长,但我会将它们的值添加到文章 –

+0

更新不应该删除记录,除非您有一个奇怪的外键设置或某种注入漏洞。 –

回答

1

如果$ unique_string和$ savestring都是未初始化的,我希望你会将你的索引列设置为空 - 这将导致它们不会在任何使用该索引列的选择中出现?

也许你的意思是$ uniquestring和$ save_string?或者这些变量可能是out of scope