search results in table with rows limit php - php

I created a web site and i added search option which show search results in table, i want to limit rows number to 5 by page please help me to do that:
i would like also to make search results in random sort for each search operation, not the same results are shown on the first page each search :
this is my search code :
$query = mysql_query("SELECT * FROM table WHERE company LIKE '$company' and activity LIKE '$activity'");
echo "<h3>search results</h3><p>";
echo "<table border='1' align='center' >
<tr>
<th>phone</th>
<th>city</th>
<th>activity</th>
<th>company</th>
</tr>";
while($row = mysql_fetch_array($query))
{
echo "<tr>";
echo "<td>" . $row['phone']. "</td>";
echo "<td>" . $row['city']. "</td>";
echo "<td>" . $row['activity']. "</td>";
echo "<td>" . $row['company']. "</td>";
echo "</tr>";
}
echo "</table>";
$anymatches=mysql_num_rows($result );
if ($anymatches == 0)
{
echo "<h3>sorry no results</h3>";
}
?>
thank you.

Change your query first into
$query = mysqli_query($con,"SELECT * FROM table WHERE company LIKE '%$company%' and activity LIKE '%$activity%' ORDER BY RAND()");
We can use a counter to limit the fetching to 5.
$counter=1;
while($row = mysqli_fetch_array($query)){
if($counter<6){
echo "<td>" . $row['phone']. "</td>";
echo "<td>" . $row['city']. "</td>";
echo "<td>" . $row['activity']. "</td>";
echo "<td>" . $row['company']. "</td>";
}
else {
/* NOTHING TO DO */
}
$counter=$counter+1;
} /* END OF WHILE LOOP */
$anymatches=mysqli_num_rows($result);
if ($anymatches == 0)
{
echo "<h3>sorry no results</h3>";
}
OR you can try this, just changing your query into:
$query = mysqli_query("SELECT * FROM table WHERE company LIKE '%$company%' and activity LIKE '%$activity%' ORDER BY RAND() LIMIT 5");
Please make it clear, if you want to show only 5 results or a pagination with 5 rows per page.
If pagination is what you're looking for:
We should start by storing the data first into a table storage. For example we have a table named search with even just one field, searchfield.
$searchword=mysqli_real_escape_string($con,$_POST['searchword']);
mysqli_query($con,"UPDATE search SET searchfield='$searchword'");
/* this is where you store your search text for later purposes */
And we'll fetch it right away (Don't get me wrong, this is for the pagination purposes)
$selectsearch = "SELECT * FROM search";
$querysearch = mysqli_query($con, $selectsearch) or die(mysqli_error($selectsearch));
while($rows = mysqli_fetch_array($querysearch)){
$search = $rows['searchfield'];
}
$query = "SELECT * FROM table WHERE company LIKE '%$search%' OR activity LIKE '%$search%'"; /* do your query search */
$result = mysqli_query($con, $query);
$count = mysqli_num_rows($result);
$r = mysqli_fetch_row($result);
$numrows = $r[0];
echo '<b> '.$count.' result/s found for "'.$search.'"</b>';
$rowsperpage = 5;
$totalpages = ceil($count / $rowsperpage);
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
$currentpage = (int) $_GET['currentpage'];
} else {
$currentpage = 1;
}
if ($currentpage > $totalpages) {
$currentpage = $totalpages;
}
if ($currentpage < 1) {
$currentpage = 1;
}
$offset = ($currentpage - 1) * $rowsperpage;
$select="SELECT * FROM table WHERE company LIKE '%$search%' OR activity LIKE '%$search%' LIMIT $offset, $rowsperpage"; /* do the query again but with limit */
$result=mysqli_query($con, $select);
/*start of the table*/
{
echo "<table border='1'>
<tr>
<th>phone</th>
<th>city</th>
<th>activity</th>
<th>company</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['activity']. "</td>";
echo "<td>" . $row['company']. "</td>";
echo "</tr>";
}
echo "</table>";
}
echo '<table border="0"><tr><td>';
/* ***** build the pagination links ***** */
$range = 2;
if ($currentpage > 1) {
$prevpage = $currentpage - 1;
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'>Previous</a> ";
}
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
if (($x > 0) && ($x <= $totalpages)) {
if ($x == $currentpage) {
echo " <font color='#546f3e'><b>$x</b></font> ";
} else {
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> ";
}
}
}
if ($currentpage != $totalpages) {
$nextpage = $currentpage + 1;
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>Next</a> ";
} // end if
/* ***** end build pagination links ***** */
echo '</td></tr></table>';

You haven't written any pagination code, use MySQL LIMIT , clause.
For ordering randomly, try this:
SELECT * FROM table WHERE company LIKE '$company' and activity LIKE '$activity' ORDER BY RAND()

Start with this. In this you need to pass the page number in URL (Eg yourwebsite/your-php.php?page=0)
$page = $_GET['page'];
$perPage = 5;
$start = $page * $perPage;
$query = mysql_query("SELECT * FROM table WHERE company LIKE '$company' and activity LIKE '$activity' limit " . $start . ',' . $perPage);
echo "<h3>search results</h3><p>";
echo "<table border='1' align='center' >
<tr>
<th>phone</th>
<th>city</th>
<th>activity</th>
<th>company</th>
</tr>";
while($row = mysql_fetch_array($query))
{
echo "<tr>";
echo "<td>" . $row['phone']. "</td>";
echo "<td>" . $row['city']. "</td>";
echo "<td>" . $row['activity']. "</td>";
echo "<td>" . $row['company']. "</td>";
echo "< /tr>";
}
echo "</table>";
$anymatches=mysql_num_rows($result );
if ($anymatches == 0)
{
echo "<h3>sorry no results</h3>";
}
?>
You need to implement pagination in to this by giving link to different page numbers.
I suggest to use some MVC framework rather than having all data retrieval and view in one file.

Related

Find % according to values in one column (Need to add iteration loop) in php

I want to update 3rd column according to values based in 2nd column. Right to now I could print % value only for 1st team correctly. Other teams have wrong values.
Any help please.
echo "<table border="."1"."align="."right".">
<tr>
<th align="."center".">ID</th>
<th>Internal Team Names</th>
<th width="."10px"." >Passed % for aw34_0530_tc1015</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['ID'] . "</td>";
echo "<td>" . $row['TeamInternalNames'] . "</td>";
$TotalTestsForTeam = mysqli_query($conn ,"SELECT * from aw34_0530_tc1015 where Application="."'".$application_l."'"); //rows for ace application
$TotalTestsForTeamCount = $TotalTestsForTeam->num_rows; //rows for ace application
$PassedTestsForTeam_query= "SELECT * from aw34_0530_tc1015 where Result='passed' AND Application='".$row['TeamInternalNames']."'"; //ace passed count
$passed = mysqli_query($conn ,$PassedTestsForTeam_query);
$TotalPaassedTestsForTeam = $passed->num_rows; //rows for ace application
//echo "Count of passed ace in aw34_0530_tc1015 = TotalPaassedTestsForTeam Results "; //rows for ace application
$passed_percentForTEam = ($TotalPaassedTestsForTeam/$TotalTestsForTeamCount)*100 | 0;
echo "<td>" . $passed_percentForTEam . "</td>";
// if ($row['Result'] == "passed") {
// echo "<td style="."background-color:#33FF38".">P</td>";
// } else {
// echo "<td style="."background-color:#FF334C".">F</td>";
// }
echo "</tr>";
}
echo "</table>";

Add LIMIT query in php

How can I add LIMIT query in it? I have adding it in
$SQL = "SELECT * FROM eins_policy LIMIT 500 ";
but it did not display the list.
For example:
If I choose 500 records per page;
Total records is 3560 records;
If now I on page 1, meaning (Page number – 1) * 500 = 0, and my Offset is 0;
If now I on page 2, meaning (Page number – 1) * 500 = (2 – 1) * 500 = 500, and Offset is 500, meaning 501 to 1000 is the records fetched;
If now I on page 3, meaning (Page number – 1) * 500 = (3 – 1) * 500 = 1000, and Offset is 1000, meaning 1001 to 1500 is the records fetched;
policylist.php
function eins_listPolicy($page, $record ,$search)
{
//connect to database
base_connectDatabase();
$searchs = explode(" ", $search);
$SQL = "SELECT * FROM eins_policy ";
$countSearch = 0;
foreach ($searchs as &$value) {
if ($countSearch == 0) {
$SQL .= "WHERE ";
} else {
$SQL .= "AND ";
}
$SQL .= "(eins_plcy_code LIKE '%".$value."%' OR
eins_plcy_client IN (SELECT eins_clnt_id FROM eins_client WHERE eins_clnt_full_name LIKE '%".$value."%') OR
eins_plcy_insurance_company IN (SELECT eins_icomp_id FROM eins_insurance_company WHERE eins_icomp_name LIKE '%".$value."%') OR
eins_plcy_agent IN (SELECT eins_agent_id FROM eins_agent WHERE eins_agent_user_id IN (SELECT base_u_id FROM base_users WHERE base_u_name LIKE '%".$value."%')) OR
eins_plcy_policy_type IN (SELECT base_u_id FROM base_users WHERE base_u_name LIKE '%".$value."%') OR
eins_plcy_start_date LIKE '%".$value."%' OR
eins_plcy_end_date LIKE '%".$value."%' OR
eins_plcy_payment_status = '".$value."' OR
eins_plcy_status LIKE '%".$value."%')
";
$countSearch ++;
}
$result = base_executeSQL($SQL);
$total = base_num_rows($result);
if(is_int($total/$record)) {
$tpages = $total/$record;
} else {
$tpages = floor($total/$record)+1;
}
$start = $record * ($page-1);
$adjacents = 3;
$reload = 'policy_list.php';
$count = 0;
$zeroRecord = false;
$RSQL = "LIMIT ".$start.", ".$record."";
$getPolicySQL = base_executeSQL($SQL.$RSQL);
while($Policy_row = base_fetch_array($getPolicySQL))
if (base_num_rows($getPolicySQL)!= 0) {
$inscompName = eins_getInscompDetail($Policy_row["eins_plcy_insurance_company"]);
$agentName = eins_getAgentDetail($Policy_row["eins_plcy_agent"]);
$clientName = eins_getClientDetail($Policy_row["eins_plcy_client"]);
$polocytypeName = eins_getPolicytypeDetail($Policy_row["eins_plcy_policy_type"]);
$count = $count + 1;
echo "<tr>";
echo "<td>". $count ."</td>";
echo "<td>". $Policy_row["eins_plcy_code"] ."</td>";
echo "<td>". $polocytypeName['eins_ptype_name'] ."</td>";
echo "<td>". $inscompName['eins_icomp_name'] ."</td>";
echo "<td>". $agentName['eins_agent_full_name'] ."</td>";
echo "<td>". $clientName['eins_clnt_full_name'] ."</td>";
echo "<td>". $Policy_row["eins_plcy_payment_status"] ."</td>";
echo "<td>". $Policy_row["eins_plcy_status"] ."</td>";
echo "<td><img src=\"". BASE_IMG_ICON_EDIT ."\" /></td>";
echo "<td><img src=\"". BASE_IMG_ICON_DELETE ."\" /></td>";
echo "</tr>";
}
if (base_num_rows($getPolicySQL)== 0) {
echo "<tr><td colspan = \"9\" align = \"center\">There is no record!</td></tr>";
$zeroRecord = true;
}
if($zeroRecord == false) {
echo "<tfoot bgcolor=\"white\">";
echo "<tr>";
echo "<td colspan=\"10\">";
$record .= "&search=".$search;
eins_paginate($reload, $page, $tpages, $adjacents, $record, $total) ;
echo "</td>";
echo "</tr>";
}
//close the database
base_closeDatabase();
}
The correct usage of LIMIT is LIMIT offset, max rows
First 500 rows : ... LIMIT 0,500
The next 500: ... LIMIT 500,500 and so on.
Reference: http://dev.mysql.com/doc/refman/5.7/en/select.html

output data based on two tables

I need to output a table based on two other tables as shown below:
case: there are two table "tbl_schedule" and "tbl_report"
this is my script:
$sql = mysql_query("SELECT*, count(*) as schedule_date FROM mst_schedule WHERE schedule_date LIKE '%$date' GROUP BY schedule_account") or die (mysql_error());
while ($data = mysql_fetch_array($sql)) {
$account = schAccount($data['schedule_account']);
$sql2 = mysql_query("SELECT * FROM trn_reportsch WHERE schedule_id='$data[schedule_id]' GROUP BY schedule_id");
echo "<tr>";
echo "<td>".ucfirst($account['admin_fullname'])."</td>";
while ($data2 = mysql_fetch_array($sql2)) {
echo "<td>".$data2['rating']."</td>";
}
echo "<td>".$data['schedule_date']."</td>";
echo "</tr>";
}
So far I don't get the desired output. How should I change the script?
Your code is almost correct.
Add following lines:
$sql = mysql_query("SELECT*, count(*) as schedule_date FROM mst_schedule WHERE schedule_date LIKE '%$date' GROUP BY schedule_account") or die(mysql_error());
while ($data = mysql_fetch_array($sql)) {
$account = schAccount($data['schedule_account']);
$sql2 = mysql_query("SELECT * FROM trn_reportsch WHERE schedule_id='$data[schedule_id]' GROUP BY schedule_id");
echo "<tr>";
echo "<td>" . ucfirst($account['admin_fullname']) . "</td>";
$bad = $good = $vGood = 0; // <-- ADD THIS LINE
while ($data2 = mysql_fetch_array($sql2)) {
if($data2['rating'] <=2){ // BAD
$bad++;
} else if($data2['rating'] <= 3){ // GOOD
$good++;
} else if($data2['rating'] > 3){ // VERY GOOD
$vGood++;
}
}
echo "<td>" . $bad . "</td>"; // Display the final value for bad
echo "<td>" . $good . "</td>"; // Display the final value for good
echo "<td>" . $vGood . "</td>"; // Display the final value for very good
echo "<td>" . $data['schedule_date'] . "</td>";
echo "</tr>";
}

pagination within if not working properly

I am building a search page where the user can search by a field and then the table is displayed.I am trying to implement pagination through php in it but the pagination is not working.Any guidelines to paginate will be helpful.I am presenting the code of one if where the user has entered 1st field and the other fields are left blank,there are other condition as well.
if($item!="" && $brand=="" && $model=="") {
$sql ="SELECT * FROM table WHERE Product LIKE '%".$item."%' ";
$result = mysql_query($sql);
//$result1 = mysql_query($sql1);
$r = mysql_fetch_array($result);
$p=$r['Product'];
$b=$r['Brand'];
$m=$r['Model'];
if ($item!=$p) {
echo "<font style=\"color:Red;\"><h3>No Item Found!!!</h3></font>";
} else {
echo "<table class='table table-striped table-bordered bootstrap-datatable datatable'>
<thead>
<tr>
<th>Item</th>
<th>Brand</th>
<th>Model</th>
<th>Dealer Price</th>
<th>Quantity</th>
<th>Description</th>
</tr>
</thead>";
if (!(isset($pagenum))) {
$pagenum = 1;
}
//Here we count the number of results
//Edit $data to be your query
$data = mysql_query("SELECT * FROM table WHERE Product='$item' ") or die(mysql_error());
$rows = mysql_num_rows($data);
//This is the number of results displayed per page
$page_rows = 10;
//This tells us the page number of our last page
$last = ceil($rows/$page_rows);
//this makes sure the page number isn't below one, or more than our maximum pages
if ($pagenum < 1) {
$pagenum = 1;
} elseif ($pagenum > $last) {
$pagenum = $last;
}
//This sets the range to display in our query
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
$sqll ="SELECT * FROM table WHERE Product='$item' $max ";
$resultt = mysql_query($sqll);
echo "<tbody>";
while($row = mysql_fetch_array($resultt)) {
echo "<tr>";
echo "<td>" . $row['Product'] . "</td>";
echo "<td>" . $row['Brand'] . "</td>";
echo "<td>" . $row['Model'] . "</td>";
echo "<td>" . $row['Dprice'] . "</td>";
echo "<td>" . $row['Quantity'] . "</td>";
echo "<td>" . $row['Quality'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo " --Page $pagenum of $last-- <p>";
// First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page.
if ($pagenum == 1) {
} else {
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> ";
echo " ";
$previous = $pagenum-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> ";
}
//just a spacer
echo " ---- ";
//This does the same as above, only checking if we are on the last page, and then generating the Next and Last links
if ($pagenum == $last) {
} else {
$next = $pagenum+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> ";
echo " ";
echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> ";
}
} elseif($item=="" && $brand!="" && $model=="") {
...so on
I have tried paginating the table,10 rows are visible in the first page,but on going to the next page no table is showing,although there are other data s in the table.
The error is that you must add at the top of first file
$pagenum = filter_input(INPUT_GET, 'pagenum', FILTER_SANITIZE_NUMBER_INT);
You can't access to $pagenum directly without assign it a value from $_GET param.
I hope this is useful!

Sort and Pagination combined, PHP with SQL

I've got a CV database, you can see the fields below and they are pretty standard. Retrieval is done by a simple form sending the information into an SQL database.
I was happy with my simple system till I was flooded with over 500 applicants in my inbox. My previous system allowed me to view the applicants only one by one which would have taken forever...
What I'm trying to achieve is a simple backend page similar to the phpmyadmin of the table view. (no i don't want to just use phpmyadmin as i'd like to give the CV sifting task to other employees)
Basically the concept is to display the table like an excel, allow sorting by clicking on headers, pagination [20 rows per page] and a check box to delete row.
I'm ok with asking for some help as I have put alot of effort into trying to figure this out ;)
So far what i've got is:
The sorting works no problem, clicking on one of the headers spits out localhost/mena/new3.php?sort=fname to the address bar and parses the correct Sql query and sorts the page.
The pagination so far does not work. The page displays all 815 candidates. It is providing the numbered links 1-42 that when clicked on result in the address bar changing to localhost/new3.php?page=2 but 0 change.
Also for the life of me i can't see how to include the php delete into this..
9 yo pseudo code idea of it is :
//Input the rows from SQL
While($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td> $checkbox1
if checkbox1=true then mysqli_query($con,"DELETE FROM cv WHERE .$row[].");
echo "<td>" . $row['title'] .
My code so far:
<?php
$con=mysqli_connect("localhost","root","","test_db-jil");
// Check connection
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Pagination
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * 20;
// Sort, from headers.
if(isset($_REQUEST['sort'])){
if($_GET['sort'] == "title"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY title");
}
elseif($_GET['sort'] == "fname"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY fname");
}
elseif($_GET['sort'] == "lname"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY lname");
}
elseif($_GET['sort'] == "gender"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY gender");
}
elseif($_GET['sort'] == "dob"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY dob");
}
elseif($_GET['sort'] == "nationality"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY nationality");
}
elseif($_GET['sort'] == "language"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY language");
}
elseif($_GET['sort'] == "phone"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY phone");
}
elseif($_GET['sort'] == "email"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY email");
}
elseif($_GET['sort'] == "uni"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY uni");
}
elseif($_GET['sort'] == "prog"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY prog");
}
elseif($_GET['sort'] == "graddate"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY graddate");
}
elseif($_GET['sort'] == "startdate"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY startdate");
}
elseif($_GET['sort'] == "grad"){
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY grad");
}
else{
$result = mysqli_query($con,"SELECT * FROM cv ORDER BY fname");
}
}
else{ // Default if no parameters passed
$result = mysqli_query($con,"SELECT * FROM cv");
}
//Table of Content
echo "<table border='1'>
<tr>
<th><a href=new3.php?sort=title>Title</a></th>
<th><a href=new3.php?sort=fname>First Name</a></th>
<th><a href=new3.php?sort=lname>Last Name</a></th>
<th><a href=new3.php?sort=gender>Gender</a></th>
<th><a href=new3.php?sort=dob>Date Of Birth</a></th>
<th><a href=new3.php?sort=nationality>Nationality</a></th>
<th><a href=new3.php?sort=language>Language</a></th>
<th><a href=new3.php?sort=phone>Phone No</a></th>
<th><a href=new3.php?sort=email>Email</a></th>
<th><a href=new3.php?sort=uni>University</a></th>
<th><a href=new3.php?sort=prog>Program</a></th>
<th><a href=new3.php?sort=graddate>Graduated</a></th>
<th><a href=new3.php?sort=startdate>Start Date</a></th>
<th><a href=new3.php?sort=grad>Applying for</a></th>
<th>CV File</th>
</tr>";
//Input the rows from SQL
While($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['fname'] . "</td>";
echo "<td>" . $row['lname'] . "</td>";
echo "<td>" . $row['gender'] . "</td>";
echo "<td>" . $row['dob'] . "</td>";
echo "<td>" . $row['nationality'] . "</td>";
echo "<td>" . $row['language'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['uni'] . "</td>";
echo "<td>" . $row['prog'] . "</td>";
echo "<td>" . $row['graddate'] . "</td>";
echo "<td>" . $row['startdate'] . "</td>";
echo "<td>" . $row['grad'] . "</td>";
echo "<td>" . $row['cvfilename'] ."</td>";
echo "</tr>";
}
echo "</table>";
//Get total count of rows then ceil divide by 20 as pages
$sql = "SELECT COUNT(*) as 'num' FROM cv";
$total_pages = $con->query($sql) or die(mysqli_error($connection));
$row = $total_pages->fetch_assoc();
$total_pages = ceil($row['num'] / 20);
for ($i=1; $i<=$total_pages; $i++) {
//Can I ?page= and ?sort= ??????
echo "<a href='new3.php?page=".$i."'>".$i."</a> ";
};
mysqli_close($con);
?>
Recap, please help me fix pagination, have it work with sort and finally add a delete check box to each row. :)
You know you can optimize that entire block of "else if" statements by just assigning the
$_GET to a variable:
$type = $_GET;
Then use that in your mysqli:
$result = mysqli_query($con, "SELECT * FROM cv ORDER BY $type");
To limit your results use LIMIT:
$result = mysqli_query($con, "SELECT * FROM cv ORDER BY $type LIMIT 20, $page");
20 = how many to return
$page = where you want the results to start from

Categories