You need to do some error handling, as in:

>       $mysql_result = mysql_query($query, $mysql_link);
> 
>         // get each row
> 
> --> line 36       while($row = mysql_fetch_row($mysql_result))
> 

Make sure $mysql_result is a valid resource as PHP
is telling you it's not.  Here's one way:

if (!$mysql_result) {
    echo "DB Error ($query) : " . mysql_error();
    exit;
}

while ($row = mysql_fetch_row($mysql_result)) {
    ....
}

See?  We made sure $mysql_result isn't false as the
function mysql_query returns false on failure. If
it is false, we print some useful info out to
debug it.  In production, you most likely won't want
to print it out but anyway...

For a more complete example, see:

  http://www.php.net/mysql_fetch_assoc

Btw, being that there is a function named mysql_result
I wouldn't create a variable by that name, kinda confusing.

Regards,
Philip Olson

p.s. mysql_error is your friend.




>         {
>         
>         //get columns
>        
>           $id = $row[0];
>           $ynimi = $row[1];
>           $ylahi = $row[2];
>           $ypostios = $row[3];
>           $ypostitmp = $row[11];
> 
>           print("<TABLE WIDTH=\"750\" BORDER=\"0\">\n");   
>           print("<TR>\n");
>              
>           print("<TD WIDTH=\"550\">$ynimi, $ylahi, $ypostios
> $ypostitmp<TD>\n");
>           print("<TD WIDTH=\"200\"><A
> HREF=\"tarkenna.php3?id=$id\">MUOKKAA></A> - <A
> HREF=\"poista.php3?id=$id\">POISTA></A><TD>");
> 
>           print("</TR>\n");
>           print("</TABLE>\n");
> 
>         }
> 
>         // disconnect 
>         mysql_close($mysql_link);
> ?>
> 
> when run, i'll following error messages:
> 
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
> result resource in /www/domains/lammidb.phnet.fi/public_html/kaikki.php3
> on line 36
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to