asked on
ASKER
ASKER
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>My web page</title>
<?php
include 'inc/config.php';
include 'inc/opendb.php'; ?>
<link rel="stylesheet" type="style/principal.css" />
</head>
<body>
<div>
<!-- QUERY STARTS HERE --->
<?php
// get the current page from the query string if it has been passed
$curpage=$_GET['curpage'];
//if not or if it is invalid, make it default to the first page
$curpage > 0 or $curpage=1;
// set the number of rows per page
$npp=5;
mysql_query("SET NAMES 'charset=CP1251' ", $conn );
$query = "SELECT * FROM `ap_form_1` INNER JOIN `ap_element_options` ON (ap_form_1.element_4 = ap_element_options.option_id) ORDER BY ID DESC";
$query.=" LIMIT ".(($curpage-1)*$npp)." , ".$npp;
$result = mysql_query($query, $conn );
if( $result === FALSE ) {
echo '<div class="ERROR">'.mysql_error().'</div>';
} else {
while($row = mysql_fetch_array($result))
{
// print the previous link if the current page was not the first one
$curpage > 1 and print('<a href="?curpage='.($curpage-1).'">prev</a>');
echo "<div id=\"bloque\">
<div id=\"fecha\">" . utf8_encode($row["element_1"]). "</div>
<div id=\"actititle\">" . utf8_encode($row["element_3"]). "</div>
<div id=\"actititle\">" . utf8_encode($row["element_5"]). "</div>
<div id=\"actititle\">" . utf8_encode($row["option"]). "(Tipo de archivo)</div>
<div id=\"actititle\">" . utf8_encode($row["element_6"]). "</div>
";
}
}
?>
<!--END QUERY--->
</div>
</body>
</html>
ASKER
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
http://www.sitepoint.com/perfect-php-pagination/
If that is not helpful, please post back here and we can look into it further. Best, ~Ray