Even weirder!
| From: | Lynn Siprelle | Date: | Mon, 08 Jan 2001 07:08:23 +0000 |
| Subject: | Even weirder! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5695@lists.php.net to get a copy of this message | ||
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");
}
}
}
This produces weird results, as I'm sure you might imagine:
Error performing statement error: 0
Warning: Supplied argument is not a valid MySQL result resource in
/usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 30
Warning: Supplied argument is not a valid MySQL result resource in
/usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 31
In Clean and Organized:
Nothing new today.
Warning: Supplied argument is not a valid MySQL result resource in
/usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 30
Warning: Supplied argument is not a valid MySQL result resource in
/usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 31
In Crafts and Decorating:
Nothing new today.
Warning: Supplied argument is not a valid MySQL result resource in
/usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 30
Warning: Supplied argument is not a valid MySQL result resource in
/usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 31
In Family:
Nothing new today.
SO. Even though I'm getting an error result, the names ARE getting put into $result, otherwise
the "no new messages" routine wouldn't generate, no? Am I having trouble, she asks
naively, because this is written into an include file rather than into the page itself, which has
its own connection to the same db?
If you weren't all scattered around the globe I'd bake you all brownies.
Thanks,
Lynn
--
Lynn Siprelle, Siprelle & Associates: Web Construction and Publishing
Chief Assoc. Josephine b. 9/9/97 * New Assoc. Louisa due 5/1/01
Business: lynn@siprelle com | Personal: lynsa@siprelle.com
The New Homemaker: http://www.newhomemaker.com/