Re: Stupid newbie looping MySQL question

From: Date: Mon, 08 Jan 2001 17:17:57 +0000
Subject: Re: Stupid newbie looping MySQL question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5710@lists.php.net to get a copy of this message
>Ok, then everything should be fine. You just need to eliminate silly >mistakes. Make sure all arguments you pass to mysql_fetch_* functions are >actually result identifiers. A result identifier is the return value from >a mysql_query() or mysql_db_query() call. I feel like I'm wasting a lot of people's time with something I should have been able to figure out myself through reading/study, and I sincerely apologize that I haven't been able to. I honestly tried before I came here for help. And my embarrassment is compounded upon discovering that I was looking for the wrong column in the forums table. aaaaagh! That is just the sort of thing you don't want to find out when people are helping you. But problems remain. This is what I am now trying: while($row=mysql_fetch_object($result)) { $fid = $row->id; $mynextquery ="SELECT id, datestamp, thread, subject, author FROM $row->table_name ORDER BY datestamp ASC LIMIT 0, 20"; $result2 = mysql_query($mynextquery); if (!$row2 = mysql_fetch_object($result2)) { //this is line 27 print ("<b>In <a href=\"/phorum/list.php?f=$fid\">$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=$fid\">$row->name</a></b>:</br>\n"); while($row2 = mysql_fetch_object($result2)) { print ("<font size=-1>" . date_format($s_row->datestamp, '%b %e, %Y') . ": <a href=\"/phorum/read.php?f=$fid&t=$s_row->thread&i=$s_row->id#i$s_row->id\">$s_row->subject</a>--$s_row->author</font><br>\n"); } } } And this is what I get: In Clean and Organized: 01-06-01 12:25 am: Getting peeved--Lynn Siprelle, Editor 01-06-01 12:44 am: Re: Getting peeved--Lynn Siprelle, Editor 01-06-01 11:13 am: Re: Testing a new forum--Lynn Siprelle, Editor 01-06-01 11:19 am: Re: Testing a new forum--Lynn Siprelle, Editor In Crafts and Decorating: Warning: Supplied argument is not a valid MySQL result resource in /usr/home/sip1/www/htdocs/tnh/phorum/new.php on line 27 In Family: Nothing new today. In other words, it's working fine the first time through the loop. The second time through, it's not picking up a test posting I put in that topic, but it's not giving an error message. The third time through, it's not liking $result2 (because there's nothing in the Family table?). Thank you all for the time you've given me. A very humble and embarrassed L -- 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/

« previous php.db (#5710) next »