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'");}
精彩评论