On Sat, 2003-12-27 at 17:17, tony wrote:
> hello
> 
> I'm new with php just learning and i have just a problem with the following
> code
> 
> $dbconnect = mysql_connect("localhost", "prog_tony","PASSWORD");
> mysql_select_db("prog_dealer", $dbconnect);
> $stop = 0;
> $counter = 1;
> while(!$stop){
>         $query = "SELECT name FROM category WHERE id = $counter";
>         $dbdo = mysql_query($query,$dbconnect);
>         while($row= mysql_fetch_array($dbdo)){
>                 if($row[0]){
>                         $counter++;
>                 }else{
>                         $stop=1;
>                 }
>                         $row[0] = "";
>         }
> 
> }
> 
> 
> 
> I'm getting an error with mysql_fetch_array() which is line 14 because I
> didn't show the other lines since it is not relevant.
> here is the error
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
> resource in /home/prog/public_html/php/cateadded.php on line 14

Try checking your query results. mysql_query might return false which is
not a valid result.

$dbdo = mysql_query($query, $dbconnect)
        or die(mysql_error());

That should let you know what is going on.

- Brad

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

Reply via email to