RingsWorld.com RingsWorld.com [Have a Blog? Submit It!new] [Create your Site-Ring Community]

PHP - my_pagina_class

:(: Messages Boards, Forums and Discussions :):
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat Oct 11, 2008 11:41 am
All times are GMT
Board.RingsWorld.com » Internet » Webmaster Community » Programming » PHP
my_pagina_class
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
RSS Feed Add to My MSN Add to My Yahoo! Add to Google
Global Discussions
Author Message
Guest





PostPosted: Mon Aug 07, 2006 5:22 am    Post subject: Question my_pagina_class
Subject description: php pagination class
Reply with quote

My sql sets up a variable number of fields as well as search values. I get the pagination navigation bar on the first screen, but am kicked into a different navigation set on the second screen. My php pagination script that invokes the my_pagina class is below. Please help.


<?php
include ('my_pagina_class.php');
$test = new MyPagina;

if ($_SERVER['REQUEST_METHOD'] == "POST") {
$typ = $_POST['typ'];
$city = $_POST['city'];
$state = $_POST['state'];
$dayB = $_POST['dayB'];
$monthB = $_POST['monthB'];
$yearB = $_POST['yearB'];
$dayE = $_POST['dayE'];
$monthE = $_POST['monthE'];
$yearE = $_POST['yearE'];
$beds = $_POST['beds'];
$range = $_POST['range'];
}

// Generate the SQL command for doing a select from the Database
$searchStmt = "SELECT *
FROM ownerjan,touristjan
WHERE " ;

if ($typ)
$searchStmt .= "ownerjan.typ LIKE '%$typ%' AND ";
if ($city)
$searchStmt .= "ownerjan.city LIKE '%$city%' AND " ;
if ($state)
$searchStmt .= "ownerjan.state LIKE '%$state%' AND " ;
if ($dayB)
$searchStmt .= "touristjan.dayB LIKE '%$dayB%' AND " ;
if ($monthB)
$searchStmt .= "touristjan.monthB LIKE '%$monthB%' AND " ;
if ($yearB)
$searchStmt .= "touristjan.yearB LIKE '%$yearB%' AND " ;
if ($dayE)
$searchStmt .= "touristjan.dayE LIKE '%$dayE%' AND " ;
if ($monthE)
$searchStmt .= "touristjan.monthE LIKE '%$monthE%' AND " ;
if ($yearE)
$searchStmt .= "touristjan.yearE LIKE '%$yearE%' AND " ;
if ($beds)
$searchStmt .= "touristjan.beds LIKE '%$beds%' AND " ;
if ($range)
$searchStmt .= "touristjan.range LIKE '%$range%' AND " ;
$searchStmt .= "ownerjan.username = touristjan.username AND " ;

$stmt= substr($searchStmt, 0, strlen($searchStmt)-4) ;

$test->sql = $stmt; // the (basic) sql statement (use the SQL whatever you like)
$result = $test->get_page_result(); // result set
$num_rows = $test->get_page_num_rows(); // number of records in result set
$nav_links = $test->navigation(" , ", "currentStyle"); // the navigation links (define a CSS class selector for the current link)
$nav_info = $test->page_info("to"); // information about the number of records on page ("to" is the text between the number)
$simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images
$total_recs = $test->get_total_rows(); // the total number of records
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Stand By Oz Accomodation Search</title>
<link rel='stylesheet' type='text/css' href='style.css'>
</head>

<body>

<p><?php echo "record ".$nav_info."".$total_recs; ?></p>


<?php


for ($i = 0; $i < $num_rows; $i++) {
$name = mysql_result($result, $i, "name");
$addr = mysql_result($result, $i, "addr");
$city = mysql_result($result, $i, "city");
$state = mysql_result($result, $i, "state");
$email = mysql_result($result, $i, "email");
$url = mysql_result($result, $i, "url");
$phone = mysql_result($result, $i, "phone");
$beds = mysql_result($result, $i, "beds");
$reg_price= mysql_result($result, $i, "reg_price");
$price = mysql_result($result, $i, "price");
$dayB = mysql_result($result, $i, "dayB");
$monthB = mysql_result($result, $i, "monthB");
$yearB = mysql_result($result, $i, "yearB");
$dayE = mysql_result($result, $i, "dayE");
$monthE = mysql_result($result, $i, "monthE");
$yearE = mysql_result($result, $i, "yearE");
echo "<center><table class='tourist'>";
echo "<tr><td>Name:&nbsp;&nbsp;".$name. "</td></tr>";
echo "<tr><td>Address:&nbsp;&nbsp;".$addr. "</td></tr>";
echo "<tr><td>City:&nbsp;&nbsp;".$city. "</td>";
echo "<td>State:&nbsp;&nbsp;".$state. "</td></tr>";
echo "<tr><td>Email:&nbsp;".$email. "</td></tr>";
echo "<tr><td>URL:&nbsp;&nbsp;".$url. "</td></tr>";
echo "<tr><td>Phone:&nbsp;&nbsp;".$phone. "</td></tr>";
echo "<tr><td>Beds:&nbsp;&nbsp;".$beds. "</td></tr>";
echo "<tr><td>Regular Price:&nbsp;&nbsp;$".$reg_price."</td><td>Standby Price:&nbsp;&nbsp;$".$price."</td></tr>";
echo "<tr><td>Available from:&nbsp;&nbsp;".$dayB."&nbsp;&nbsp;".$monthB."&nbsp;&nbsp;".$yearB."&nbsp;&nbsp;to&nbsp;&nbsp;".$dayE."&nbsp;&nbsp;".$monthE."&nbsp;&nbsp;".$yearE."</table></center><br>\n";

}

echo "<p>".$nav_links."</p>";

?>
</body>
</html>
<?php $test->free_page_result(); // if your result set is large then free the result here ?> Thinking Thinking
Back to top

Give your opinions and earn cool Rewards. Receive up to $50 per survey plus a chance to win an iPhone.
fourcs



Joined: 07 Aug 2006
Posts: 2
Location: australia
PostPosted: Mon Aug 07, 2006 8:26 am    Post subject: Note my_pagina_class
Subject description: pagination
Reply with quote

The pagination navigation bar when clicked bumps me into a read-out of the entire database, not my query. Rolling Eyes
Back to top
fourcs



Joined: 07 Aug 2006
Posts: 2
Location: australia
PostPosted: Tue Aug 08, 2006 10:06 am    Post subject: Note my_pagina_class
Subject description: fix
Reply with quote

I fixed it. The class was apparently looking for the _GET array; my form used the post method. The fix was to change this to get as well as referencing the fields with the _GET array. Smile The my_pagina class works quite well!
Back to top

Give your opinions and earn cool Rewards. Receive up to $50 per survey plus a chance to win an iPhone.
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Board.RingsWorld.com » Internet » Webmaster Community » Programming » PHP
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
PHP: Latest Discussions
Missing openssl
by phpwizard01 - 490 days ago
Need a good captcha generating php script
by danielus - 522 days ago
Glossary and Dictionary Script
by GLOSSARYSCRIPT - 536 days ago
phpBannerExchange2.0 Banner Error
by Yuripro84 - 558 days ago
phpbannerexchange2.0 urgent
by Yuripro84 - 558 days ago
php hit counter
by kwayug - 564 days ago
php codes for downloading and uploading a folder/directory
by kwayug - 564 days ago
comments script on webpage
by osterhas - 582 days ago
Problem with PHP & MySql Database
by rice_Jacob - 606 days ago
Php developers community
by rice_Jacob - 606 days ago
Free PHP Scripts
by coguy11 - 608 days ago
CMS
by Urban Legend - 624 days ago

Link to this Page

If you want to link to this page you can use the following URL:


Example:
 
The PHP Web-Ring Community
The PHP Web-Ring Community
The purpose of this Ring is to link together the best sites and resources on the PHP programming language. Everyone with a quality site is welcome to join. (tutorials, documentation, tips, help, forums,...)
(14 members)

» Submit your site and Join The PHP Web-Ring Community
 
 

External Links
 

PHP NewsLetter
Sign-up to receive daily news on PHP by email.
Your email:


Newave will never sell or share your email address and you can of-course unsubscribe at anytime.

0.069889068603516