I've been using JSP for some time now, and thought I'd write a couple of rdbms explorers (flat tables, simple master/detail paradigm) using other technologies, like PHP, Cocoon, etc. Well...it's been fun. I have more working than not. But now I am hung up. I am getting wierd results in a php script when I simply change the order of some mysql calls. I'm using php-4.3.2, rh9, and mysql 3.23. My error is the following (the first line above the Warning below is a dump of parameters to the showMaster function which is what's bombing): conn=Resource id #3 databaseName=info tableName=movies fieldName=title fieldValue=36th Chamber Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /foo/bar/mywebsite/private/database.php on line 107 Line 107 is the <first> mysql_num_rows call below. function showMaster($conn, $databaseName, $tableName, $fieldName, $fieldValue) { echo "conn=$conn\n"; echo "databaseName=$databaseName\n"; echo "tableName=$tableName\n"; echo "fieldName=$fieldName\n"; echo "fieldValue=$fieldValue\n"; ========This code fails when placed here========== $result = mysql_query("SELECT * FROM $tableName where $fieldName='$fieldValue'", $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo "numRows=$numRows\n"; ======================================== $fields = mysql_list_fields($databaseName, $tableName, $conn); $numFields = mysql_num_fields($fields); echo "<TABLE border=1 width=100%>\n"; echo "<tr>"; for($i = 0; $i < $numFields; $i++) { printf("<td>%s</td>", mysql_field_name($fields, $i)); } echo "</tr>"; ========The SAME code succeeds when placed here!!!!!========== $result = mysql_query("SELECT * FROM $tableName where $fieldName='$fieldValue'", $conn); $numRows = mysql_num_rows($result); if(mysql_num_rows($result) == 1) { showDetail($conn, $databaseName, $tableName, $fieldName, $fieldValue, $result); exit; } echo "numRows=$numRows\n"; ======================================== while($myrow = mysql_fetch_array($result)) ...rest of method... } Any ideas on why this is? When I move the lines above (from $result=...to...echo 'numRows') down a few lines to just before the mysql_fetch_array, then everything works. Whazzup?!? mike klein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php