我有一个数据库,如果我的查询字符串与我指定的表的列值匹配,我想更改某个表的行值的状态。
这是我到目前为止所做的事情。
<?php
$connection = mysql_connect("localhost", "creative_db", "samplepassword");
$db = mysql_select_db("creative_dbgogo", $connection);
$slct = mysql_query("UPDATE zombie_links SET link_status = 'discard' WHERE link_url = '%pills%' OR link_url_title = '%pills%' OR link_title = '%pills%' OR link_title_url = '%pills%' OR link_content = '%pills%' OR link_summary = '%pills%' OR link_tags= '%pills%' ") or die(mysql_error());
?>
我做错了什么?请帮忙!
答案 0 :(得分:1)
=
不会使用通配符。我想你想要like
:
UPDATE zombie_links
SET link_status = 'discard'
WHERE link_url like '%pills%' OR link_url_title like '%pills%' OR link_title like '%pills%' OR
link_title_url like '%pills%' OR link_content like '%pills%' OR
link_summary like '%pills%' OR link_tags like '%pills%';
答案 1 :(得分:0)
试试这个
$slct = mysql_query("UPDATE zombie_links SET link_status = 'discard' WHERE link_url like '%pills%' OR link_url_title like '%pills%' OR link_title like '%pills%' OR link_title_url like '%pills%' OR link_content like '%pills%' OR link_summary like '%pills%' OR link_tags like '%pills%' ") or die(mysql_error());