|
Posted by Jerry Stuckle on 12/17/26 11:56
Petr Vileta wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> píše v diskusním příspěvku
> news:47CdnZB6N_1W_H3ZnZ2dnUVZ_sadnZ2d@comcast.com...
>
> 1: <html><body>
> 2: <?php
> 3: <?php
> 4: $link = mysql_connect("localhost", "user", "password")
> or die("Grr: " . mysql_error());
> 6: mysql_select_db("my_dbf") or die("Grr");
> 6: $query = "select id from my_table where id < 4 order by id";
> 7: $result = mysql_query($query) or die("Grr: " . mysql_error());
> 8: $rows = mysql_num_rows($result);
> 9: echo "Rows=", $rows, "<br>" ;
> 10: list_it($result);
> 11:
> 12: function list_it($result)
> 13: {
> 14: while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
> 15: {
> 16: echo $row["id"], "<br>";
> 17: }
> 18: }
> 19: ?>
> 20: </body></html>
>
> Warning: mysql_fetch_array(): 5 is not a valid MySQL result resource in
> F:\webpub\php\test.php on line 14.
>
>> The code you showed should not display this error. Unfortunately, you
>> left out what's probably the most important piece - the line number of
>> the failing code.
>
>
> No error but warning, but output before warning is as I expect ;-)
>
OK, if this is your entire code, then the problem shouldn't occur. I've
done similar many times with ho problems.
Either you're freed the result before calling your function, or you're
calling it from someplace else. But either way you aren't passing a
valid result object.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|