RE: [PHP-DB] Stupid newbie looping MySQL question

From: Date: Sat, 06 Jan 2001 22:46:27 +0000
Subject: RE: [PHP-DB] Stupid newbie looping MySQL question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5656@lists.php.net to get a copy of this message
At 4:37 PM -0500 1/6/01, Todd Pillars wrote: >that warning means there is no - meaning 0 - results. You might try > >if (!$result = mysql_query ("Select name from mytable")) { > printf("error: %d %s", mysql_errno($link), mysql_error($link)); >} else { >while ($row = mysql_fetch_array ($result)) { > $newTableName = $row['0']; > $sSQL = "Select id,thread,subject,author,datestamp from $newTableName order >by datestamp desc limit 30"; >} > >and see if an error is being reported. It just reports the same error: not a valid MySQL result resource, pointing at the line starting with "while". The thing is if I run "select name from mytable" in MySQL from the command line it pulls up three rows just fine; the data is there and available from that query. And I imagine that's why the "if(!$result..." clause returns false and goes into the "else" clause. For some reason, the "while" isn't picking anything up. Why would it give a warning that there isn't any data in $row when it's finding data in $result? 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/

« previous php.db (#5656) next »