Your code should look like this:
<?php
include "inc.php";
$limit = 2;
$que = "SELECT * FROM catg";
$exe = mysql_query($que);
$num = mysql_num_rows($exe);
$pages = $num/$limit ;
?>
<html>
<head><title>Delete & Edit Category</title>
<link rel="stylesheet" type="text/css" href="admin.css" />
</head>
<table>
<tr>
<td valign="top"><?php include "menu.php"; ?></td>
<td>
<?php
$pstart = 0;
if(isset($_GET['page']))
{
// Page 0 is the first page, so Page 1 is 2nd page and
// we want (therefore) to read from record 2 onwards, thus
// Current page number multiplied by limit (2).
$pstart = inval($_GET['page'])*$limit;
}
$que2 = "SELECT * FROM catg ORDER BY id ASC LIMIT $pstart,$limit";
// Error checking block. Uncomment the following two lines to check for errors:
// echo "Start value = $pstart and limit = $limit<br />";
// echo "Query passed in: $que2<br/><br />";
$exe2 = mysql_query($que2);
echo "<table><tr><td>Category</td><td>Action</td></tr>";
while ($get = mysql_fetch_array($exe2)){
echo"<tr><td>".$get['cat']."</td><td><a href='delc.php?id=".$get['id']."'>delete</a>
<a href='editc.php?id=".$get['id']."'>Edit</a></td></tr>";
}
echo "</table>";
?>
</td>
</tr><tr><td><?php for($i=1; $i<=$pages; $i++ )
echo "<a href='view.php?page=$i'>$i</a>"; ?>
</td></tr>
</table>
I have included two debugging lines for you to comment out after you write out the query. The query should look like this:
For view.php it should be: SELECT FROM catg ORDER BY id ASC LIMIT 0,2
For view.php?page=1 it should be: SELECT FROM catg ORDER BY id ASC LIMIT 2,2
For view.php?page=2 it should be: SELECT * FROM catg ORDER BY id ASC LIMIT 4,2
and so on.
The values for LIMIT are a starting record and the number of records to read, so for page do we're saying start at record 4 and read 2 records.