RE: [PHP-DB] Stupid newbie looping MySQL question
| From: | Lynn Siprelle | Date: | Sat, 06 Jan 2001 22:18:06 +0000 |
| Subject: | RE: [PHP-DB] Stupid newbie looping MySQL question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5654@lists.php.net to get a copy of this message | ||
I didn't explain this well. My apologies; I'm still learning. A better explanation:
1) First, pull a list of topics from one table;
2) Each topic name is also the name of another table--use it to pull info from that table, one by
one;
3) Once I have those rows, process each one.
Here is an example of what I've tried that hasn't worked:
$result = mysql_query ("Select name from mytable");
while ($row = mysql_fetch_array ($result)) {
$newTableName = $row['0'];
$sSQL = "Select id,thread,subject,author,datestamp from $newTableName order by datestamp desc
limit 30";
...[do a bunch more stuff...]
}
When I try this I get "Warning: Supplied argument is not a valid MySQL result
resource..." pointing to the line that begins with "while" when I run it from the
command line; running it in a page gives me a blank spot where the information should be. 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/