I have this error appearing

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /websites/123reg/LinuxPackage21/th/er/ag/theragereport.co.uk/public_html/feed/feed_view.php on line 148

from this code

$sql3="SELECT view FROM $tbl_name2 WHERE id='40'";


// if have no counter value set counter = 1
$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='40'";

// count more value
$sql5="update $tbl_name set view='$addview' WHERE id='40'";

any help would be hot

Regards Ryan Cosans


Try to isolate what is the mysql_fetch_array output..So, you may want to try running a test query instead. Something like this

if (!($rows = mysql_fetch_array($sql3)))
        return null;
      ## or maybe to print or echo something if there is none, but the return null has to be commented above.
       echo "There is nothing to show";
## if the statement above is false, then we can echo
echo $view;

Another helpful hint is to add or die(mysql_error()); on your query..

$rows=mysql_fetch_array($sql3)or die(mysql_error());

Overall, I prefer to use the first one above, because how about if id = 40 does not even exist due to auto increment?

Your problem is here


This should be

commented: yes +7

simplypixie is correct. You need to pass resultset as the argument not query. And also check whether the view is keyword of Mysql. We can't use keyword as column name. otherwise change your query as

$sql3="SELECT `view` FROM $tbl_name2 WHERE id='40'";