Next/Previous

admin

Administrator
Staff member
I am very new to PHP and have managed to build a database with mySQL.

The only problem I now have is to limit the results of a query to 50, and use a next/previous link to the others.

I have several ways, but they don't seem to work with way I am connecting (see below).

Any help would be appreciated

Regards,

Donald<?
$usr = "***";
$pwd = "***";
$db = "***";
$host = "***";

# connect to database
$cid = mysql_connect($host,$usr,$pwd);
if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); }

?>
<?


# setup SQL statement
$SQL = " SELECT * FROM XXAuthors ";
$SQL = $SQL . " WHERE AuthorID LIKE '$author'";

# execute SQL statement
$retid = mysql_db_query($db, $SQL, $cid);

# check for errors
if (!$retid) { echo( mysql_error()); }
else {

# display results

while ($row = mysql_fetch_array($retid)) {
$SName = $row["SName"];
$CName = $row["CName"];



echo ("$CName $SName<p>\n");
}
echo ("");
}
?>
 
Back
Top