Friday, 9 August 2013

How to split search results into multiple pages (joomla live searching)

How to split search results into multiple pages (joomla live searching)

I have created web page in Joomla system, This is my code for live searching.
<?php
$count= 0;
$key = $_POST['key'];
$key = addslashes($key);
$sql = mysql_query("select * from trado_virtuemart_products WHERE
product_sku LIKE '%$key%'") or die(mysql_error());
While($row = mysql_fetch_array($sql)) {
$count++;
$product_id= $row['virtuemart_product_id'];
$product_name=$row['product_sku'];
if($count<= 10){
?>
<div class="show<?php echo $product_id; ?>">
<tr>
<td><?php echo $product_name; ?></td>
</tr>
</div>
<?php }}
if($count==""){
echo "no match Found";
}else{
?>
I would like to split this search results to multiple tables. For example,
if I have 20 products it will divide my table into two tables and this
data can be switched by clicking on number of table.
I load data about products from virtuemart tables in Joomla database.
This live searching is placed in middle of one Joomla article.
Please, could you help me to do it? I have not so good skills in PHP, so
it is very hard to do it for me. But I want to improve my web page and
this is big step for me.

No comments:

Post a Comment