[QUOTE=kaisarkhan87;1628424]FOLLOW THE LINK TO VIEW AND UNDERSTAND IN A VERY SIMPLE AND EASY WAY TO DO " PAGINATION ".

[URL="

[QUOTE=sDJh;1628312]Hi Makrand,

these messages aren't errors but warnings to force you to improve your coding style. If you don't fancy that (like I do) you can set your PHP.INI variable "error_reporting" to "E_ALL^E_NOTICE". This stops php to reports these warnings ([URL="

[CODE=php]
<?php
//get the variables
$var = $_POST['query'] ;
$trimmed = trim($var);
$table = $_POST['table'];

//make connection
$conn = mysql_connect('localhost','root','123') or die("Error:".mysql_error());
mysql_select_db('sutilities',$conn) or die("Error:".mysql_error());

//delete temp search table

$del_table = "drop table search";

mysql_query($del_table) or die ("Error:".mysql_error());

// Create a MySQL table in the selected database

mysql_query("CREATE TABLE search(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
table_queried VARCHAR(30),
trimmed varchar(200))")
or die(mysql_error());

mysql_query("insert into search (table_queried, trimmed) values ('$table','$trimmed')") or die ("Error:".mysql_error());
// find out how many rows are in the table
$query = "SELECT COUNT(*) FROM $table";
$result = mysql_query($query, $conn) or die("Error:".mysql_error());
$r = mysql_fetch_row($result);
$numrows = $r[0];

// number of rows to show per page
$rowsperpage = 10;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);

// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
// cast var as int
$currentpage = (int) $_GET['currentpage'];
} else {
// default page num
$currentpage = 1;
} // end if

// if current page is greater than total pages...
if ($currentpage > $totalpages) {
// set current page to last page
$currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
// set current page to first page
$currentpage = 1;
} // end if

// the offset of the list, based on current page
$offset = ($currentpage - 1) * $rowsperpage;

// get the info from the db
if ($table == "canteen"){
$sql="select canteen.price, canteen.url, canteen.item, ...