Forums
This topic is locked
Count search results
Posted 26 May 2006 12:31:02
1
has voted
26 May 2006 12:31:02 Andrew A-P posted:
I want the page to display how many search results were found after the search. "Your search found ?? results" (Where ?? = number of results) I know that it is a count() function but I don't know the correct syntax. here is the search code I have thus far...// Searches through book title, subtitle, edition, copyright, ISBN, category, and publisher
$query_Search = "
SELECT * FROM book, category, publisher
WHERE (book.Title LIKE '%%$colname_Search%%'
OR book.Subtitle LIKE '%%$colname_Search%%'
OR book.Edition LIKE '%%$colname_Search%%'
OR book.Copyright LIKE '%%$colname_Search%%'
OR book.ISBN LIKE '%%$colname_Search%%'
OR category.CategoryName LIKE '%%$colname_Search%%'
OR publisher.PublisherName LIKE '%%$colname_Search%%')
AND book.PublisherNum = publisher.PublisherNum
AND book.CategoryNum = category.CategoryNum";
// search the database in every row
$Search = mysql_query($query_Search, $alsoszaa_books) or die(mysql_error());
$row_Search = mysql_fetch_assoc($Search);
$totalRows_Search = mysql_num_rows($Search);
Replies
Replied 26 May 2006 12:37:24
26 May 2006 12:37:24 Andrew A-P replied:
I left off a little bit to the code. This is above the code posted above...
if (count($newParams) != 0) {
$querySt$colname_Search = "1";
if (isset($HTTP_GET_VARS['searchcatalog'])) {
$colname_Search = (get_magic_quotes_gpc()) ?
$HTTP_GET_VARS['searchcatalog']
: addslashes($HTTP_GET_VARS['searchcatalog']);
}ring_Catalog = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Catalog = sprintf("&totalRows_Catalog=%d%s", $totalRows_Catalog, $queryString_Catalog);
not sure if this is needed or not
if (count($newParams) != 0) {
$querySt$colname_Search = "1";
if (isset($HTTP_GET_VARS['searchcatalog'])) {
$colname_Search = (get_magic_quotes_gpc()) ?
$HTTP_GET_VARS['searchcatalog']
: addslashes($HTTP_GET_VARS['searchcatalog']);
}ring_Catalog = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Catalog = sprintf("&totalRows_Catalog=%d%s", $totalRows_Catalog, $queryString_Catalog);
not sure if this is needed or not
Replied 29 May 2006 11:42:36
29 May 2006 11:42:36 Patrick Woldberg replied:
$totalRows_Search is the number of results found, it is the total number of rows returned by the query
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------