Re: Even weirder!
| From: | nuitari at darklands dot cx | Date: | Mon, 08 Jan 2001 17:40:58 +0000 |
| Subject: | Re: Even weirder! | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5711@lists.php.net to get a copy of this message | ||
Lynn Siprelle wrote:
>
> OK, fooling around, I came up with the following (after routines to connect with the db etc):
>
> $myquery="SELECT name FROM forums";
> if(!$result = mysql_db_query("tnh", $myquery)); {
> print("Error performing statement ");
> printf("error: %d %s", mysql_errno($link), mysql_error($link));
> }
>
> while($row=mysql_fetch_object($result)) {
> $nextquery = "SELECT id, datestamp, thread, subject, author FROM $row->name ORDER BY
> datestamp ASC LIMIT 0, 20";
>
> $sSQL = mysql_fetch_array($nextquery); //this is line 30 in the script
> if (!$s_row = mysql_fetch_object($sSQL)) { //...which makes this 31 :)
> print ("<b>In <a
> href=\"/phorum/list.php?f=$id\">$row->name</a></b>:</br>\n");
> print ("<font size=-1>Nothing new today.</font><br>\n");
> } else {
> print ("<b>In <a
> href=\"/phorum/list.php?f=$id\">$row->name</a></b>:</br>\n");
> while($s_row = mysql_fetch_object($sSQL)) {
> print ("<font size=-1>" . date_format($s_row->datestamp, '%b
> %e, %Y') . ": <a
> href=\"/phorum/read.php?f=$id&t=$s_row->thread&i=$s_row->id#i$s_row->id\">$s_row->subject</a>--$s_row->author</font><br>\n");
> }
> }
> }
That's quite an easy problem.
Line 30:
The $nextquery is a string. What you need for
mysql_fetch_array is something that comes from mysql_db_query.