开发者

MySQL where clause

In all the samples they talk about a static string in the clause:

update ranking_data set ft_kw = NULL 
WHERE ranking_data.website = 'abc.com';

Okay but what if we want a dynamic string?

update ranking_data set ft_kw = NULL WHERE ranking_da开发者_C百科ta.website = $website_name;

Which does not work. Single quote gets rid of the error msg but does not execute properly. ft_kw is never set, even a perfect match.

Can anyone give me the proper syntax on a variable string?


mysql_query(" update ranking_data set ft_kw = NULL WHERE ranking_data.website = ' " . $website_name . " ' " );


Try adding singlw quotes around $website_name:

{ mysql_query("update ranking_data set ft_kw = NULL WHERE ranking_data.website = '$website_name'");}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜