Code: <?php //This code will obtain the required page number from the $_GET array. Note that if it is not present it will default to 1.
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
} else {
$pageno = 1;
} // if
//This code will count how many rows will satisfy the current query.
$query ="SELECT * FROM `photos` WHERE `thumb_id` = '3'";
$result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
$query_data = mysql_fetch_row($result);
$numrows = $query_data[0];
//This code uses the values in $rows_per_page and $numrows in order to identify the number of the last page.
$rows_per_page = 3;
$lastpage = ceil($numrows/$rows_per_page);
//This code checks that the value of $pageno is an integer between 1 and $lastpage.
$pageno = (int)$pageno;
if ($pageno > $lastpage) {
$pageno = $lastpage;
} // if
if ($pageno < 1) {
$pageno = 1;
} // if
//This code will construct the LIMIT clause for the sql SELECT statement.
$limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page;
//Now we can issue the database qery and process the result.
$sql="SELECT * FROM `photos` WHERE `thumb_id` = '3'";
$res = mysql_query($sql) or die(mysql_error());
echo "<table>";
$i = 0;
while($row = mysql_fetch_assoc($res)){
$i++;
if ($i % 3 == 0)
echo '<tr>';
echo "<td> <img src="http://www.runningprofiles.com/members/include/myimages/thumbs/" . $row['picurl'] . "" /></a><br /> </td>";
if ($i % 3 == 0)
echo '</tr>';
if( $i == 9 ) break;
}
echo "</table>";
//... process contents of $result ...
//Finally we must construct the hyperlinks which will allow the user to select other pages. We will start with the links for any previous pages.
if ($pageno == 1) {
echo " FIRST PREV ";
} else {
echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=1'>FIRST</a> ";
$prevpage = $pageno-1;
echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=$prevpage'>PREV</a> ";
} // if
//Next we inform the user of his current position in the sequence of available pages.
echo " ( Page $pageno of $lastpage ) ";
//This code will provide the links for any following pages.
if ($pageno == $lastpage) {
echo " NEXT LAST ";
} else {
$nextpage = $pageno+1;
echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=$nextpage'>NEXT</a> ";
echo " <a href='http://www.runningprofiles.com/members/index.php?page=album&pageno=$lastpage'>LAST</a> ";
} // if
?>
Im alittle confused by my pageinated results... i only have 2 images... and for some reason its repeated these images over 11 pages... how comes?
generate seo frienly url from a text like wordpress
Convert: "åäö" to "aao", "space" to "-", "!?" to "nothing", and all to lower case.function MakeSeo($string){ ???}i want a php
User registration and login
I don't know whether this is the correct forum, if not i apologise but am pretty desperate at the moment.I have a phpbb3 forum and have a custom registration form. the password is hashed usering the
Writting a script to arrange images........ need some help
Ok so here is the linkhttp://hmtotc.com/dev/projects/vrassociates/jeweler_dev/admin/index.php?id=arrange&loc=4I am wondering if there is a way to have the text field hold a hidden value so I
2 decima places & How to reload my page
Hello There,How do i put full-stop (.) after second figure from behind? ie if i have 123456 in my database and i want it to echo as 1234.56Secondly, am designing a shopping website. I want the pages
Dynamically allocating the number of rows in a table based on a variable value
Hi, I have situation here which i cannot resolve, I have a variable temp which stores the number of rows in a array for example temp=5 which is calculated based on other values in my table( so temp
Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captures user's info on the frontpage. All the code is there except the ability to notify the admin upon
WS-Security PL/SQL Forms
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to be string, array given in
noob question
i traying to do a php form with auto replay for both(me and the user who send me a mail),a using this codeCode: <?php$contact_name = $_POST['emp'];$contact_email =
Update Myspace status with CURL
Logging in:Code: <?phpclass Myspace{ function login($username, $password) { $username = $_POST['user']; $password = $_POST['passwd']; $login_url =