PAUL FERRIE wrote:

i am getting this error returned but i dont know why :(
error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/pferrie/public_html/vinrev/adm/insert2.php on line 6

php file
<?php
include("connection.php");
if(!empty($rating)){
$query="SELECT * FROM $tablename WHERE rating = '$rating'";
 if(mysql_query($query)) {
  $myrow = mysql_fetch_array($query);//  This line returns an error!

You need to capture the return value of mysql_query(). mysql_query() is going to return a Resource that should be passed to mysql_fetch_array(), so it knows where to get each row from.


if($result = mysql_query($query))
{ $myrow = mysql_fetch_array($result);

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to