yeah sort of like that. Except you're going to want to select all the result if you want to know how many pages to select, in that code you're limiting the number of rows so you'll only end up with one page.
here's how I typically do this:
$sql = "SELECT * FROM table";
$result = mysql_query($sql);
$rows = mysql_num_rows($result);
$pages = ceil($rows/3);
if($pages>1)
{
for($i=1; $i<=$pages; $i++)
{
if($i == 1)
print "<a href=\"page.php\">Page 1</a>";
else
print "<a href=\"page.php?page=" . $i . "\">Page " . $i . "</a>";
}
}
I'm sure there's other better ways of doing this, but I haven't had any problems with this method so far. Unfortunately you'll have to do two queries with this (one with limit, and the one I just showed you), or just forget about using the limit syntax in your SQL and use PHP to regulate which results are displayed.