|
Posted by Petr Vileta on 11/14/16 11:55
"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 ;-)
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Navigation:
[Reply to this message]
|