Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001011

Re: [PHP-DB] Even weirder! From: nuitari <email protected>
Date: 01/08/01

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.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>