note 31291 rejected from function.mysql-num-rows by didou

From: Date: Thu, 19 Jun 2003 08:38:36 +0000
Subject: note 31291 rejected from function.mysql-num-rows by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-50620@lists.php.net to get a copy of this message
Note Submitter: semerkant@hotmail.com ---- 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.

« previous php.notes (#50620) next »