Php sql命令只是清除数据库表?

时间:2011-08-19 16:30:33

标签: php mysql sql database

当我尝试在我的数据库上运行此查询时:

$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条记录。

1 个答案:

答案 0 :(得分:1)

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

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