Hi I am getting this error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/likethesethings/public_html/like.php on line 9 Here is the code I have at top of like.php: <? include ("config.php"); $linkget1= trim(str_replace("-"," ",strtolower($_GET["like"]))); $linkget2= trim(str_replace("-","-",$linkget1)); $linkget3= trim(str_replace("","\\",$linkget2)); $linkget= trim(str_replace("-","\"",$linkget3)); $linkget= trim(str_replace("","?",$linkget)); $linkget= trim(str_replace("","/",$linkget)); $linkget= trim(str_replace("","@",$linkget)); $lingetk= trim(str_replace("",",",$linkget)); $linkget= trim(str_replace("-","---",$linkget)); $linkget= trim(str_replace("-","--",$linkget)); $x=mysql_query("SELECT * FROM fblike WHERE likee='".$linkget."'"); while ($y=mysql_fetch_assoc($x)){ $like=$y['likee']; $new_hits=$y['hits']+1; $hits=$y['hits']; } mysql_query("UPDATE fblike SET hits='$new_hits' WHERE like='$linkget'"); ?> It happens whenever type text in the URL as an 'id' for the page instead of a number id. Please can someone help me fix this. Thanks
you have to sanitise this: x=mysql_query("SELECT * FROM fblike WHERE likee='".$linkget."'"); <------- also, please double check you like keyword (you may want to use ` if that's the field): mysql_query("UPDATE fblike SET hits='$new_hits' WHERE like='$linkget'");