note 31291 added to function.mysql-num-rows

From: Date: Wed, 16 Apr 2003 15:50:28 +0000
Subject: note 31291 added to function.mysql-num-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-46692@lists.php.net to get a copy of this message
I have written the following php code that goes against a FULLTEXT column to do a textual search. When I use the SQL_CALC_FOUND_ROWS in the select-sql and FOUND_ROWS() as a subsequent call to get the exact matches, I get a string like "Resource Id #5". Why is it so? It may be a simple thing. I am using MySQL 4.0.12 on a Sun Solaris 8/UltraSparc platform with 512MB memory and 36GB storage. Code excerpt: // ------------------- $query = "SELECT SQL_CALC_FOUND_ROWS distinct product_name FROM PRODUCT_CATALOG WHERE MATCH(NAME, PRODUCT_NAME, CATEGORY_NAME, BRAND_NAME, DEPARTMENT_NAME, ALTERNATE_PHRASES) AGAINST('$q' IN BOOLEAN MODE ) order by $order_by MATCH(NAME, PRODUCT_NAME, CATEGORY_NAME, BRAND_NAME, DEPARTMENT_NAME, ALTERNATE_PHRASES) AGAINST('$q' IN BOOLEAN MODE ) desc LIMIT 20"; $result= mysql_query($query) or die("Query failed"); $sql_product_type_count = "SELECT FOUND_ROWS()"; $count_product_type_results = mysql_query( $sql_product_type_count ); print "<B>Product Aisles ($count_product_type_results):</B>"; // -------------------- It is supposed to return 20 rows of distinct product_name and then the second call supposed to give me a count like 31 so that i can put a "More >>" link on the page. But instead the output is like Product Aisles (Resource Id #5): Please help. Thanks in advance to everyone. -- http://www.php.net/manual/en/function.mysql-num-rows.php http://master.php.net/manage/user-notes.php?action=edit+31291 http://master.php.net/manage/user-notes.php?action=delete+31291 http://master.php.net/manage/user-notes.php?action=reject+31291

« previous php.notes (#46692) next »