Advertisement

07.31.2008 at 01:24PM PDT, ID: 23612337
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

paging problems2

Asked by jareddraper in PHP and Databases, MySQL Server

Tags: ,

I am having problems with this paging script and am not getting help. Please if you can see why its showing too many pages and not paging right will you please help me. Thanks

www.bucketsofpopcorn.com/movies.php

<?php

if(empty($_POST)) {

if (isset($_GET['letter'])) {
$letter = $_GET['letter'];
} else {$letter= false;  }
echo "<font size=1.5>";
$search = $letter;
$alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
foreach ($alphabet as $loop_letter) {
  if ($loop_letter == $letter) { echo '<B>'; }
  echo "<A HREF=\"movies.php?letter=" . $loop_letter . "\">$loop_letter</A>&nbsp;¦&nbsp;";
  if ($loop_letter == $letter) { echo '</B>'; }
}
$letter .= "%";
$sdesc = "*";
$classquery = "";
} else {
$search = $_POST['search'];
$search = "%" . $search . "%";
$sdesc = "%" . $search . "%";
$sclass = $_POST['title'];
$classquery = "AND 'title' = CONVERT( _utf8 '" . $sclass . "' USING tbl_privaterevall )";
}


include 'config.php';
include 'opendb.php';
// If current page number, use it
// if not, set one!


// Define the number of results per page
$max_results = 5;
$rowsPerPage = 5;
// Figure out the limit for the query based
// on the current page number.

$offset = ($pageNum ) * $rowsPerPage;

if (mysql_errno() != 0 ) {
echo '
';
echo $query . '
';
echo mysql_errno() . ' ' . mysql_error();
exit(0);
}
// Perform mysql query on only the current page number's results
if ($letter) {
$query  = "SELECT id, title, blog_title, blog, rating, guest, date FROM tbl_privaterevall
WHERE title LIKE  '$letter'
ORDER BY id desc LIMIT $offset, $rowsPerPage";

} else {
$query  = "SELECT id, title, blog_title, blog, rating, date FROM tbl_privaterevall
order by id desc LIMIT $offset, $rowsPerPage";

 }

 
$result = mysql_query($query);
if (mysql_errno() != 0 ) {
 echo '
';
 echo $query . '
';
 echo mysql_errno() . ' ' . mysql_error();
 exit(0);
}
 
//TO PRINT OUT THE DATA


// keeps getting the next row until there are no more to get
while($saba = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table

echo "<p><b> <font size=3> <font color=red>";
echo $saba['title'];
echo " <font size=1> </b> <font color=gray>...posted by ";
echo $saba['guest'];
echo "<br></b><font size=2> <hr><font color=orange>";
echo $saba['blog_title'];
echo "<br><font color=black>";
echo $saba['blog'];
echo "<br><i><font color=orange>";
echo $saba['rating'];
echo "<br></i></font>";
echo $saba['date'];
 
echo "<br><hr><br>";
}
 

//STOP PRINTING OUT THE DATA

// Figure out the total number of results in DB:
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tbl_privaterevall ORDER BY id DESC"),0);

// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);

// Build Page Number Hyperlinks
echo "<p class=\"center\">Pages: ";

// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['php_SELF']."?page=$prev\">&laquo;</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['php_SELF']."?page=$i &letter=$letter\">$i</a> ";
}
}

// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['php_SELF']."?page=$next\">&raquo;</a>";
}
echo "</p>";

mysql_close();
?>
Tags:
Start Free Trial
[+][-]07.31.2008 at 01:56PM PDT, ID: 22133446

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 02:03PM PDT, ID: 22133505

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 02:22PM PDT, ID: 22133655

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 02:58PM PDT, ID: 22133913

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 03:22PM PDT, ID: 22134060

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 07:48AM PDT, ID: 22138792

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 09:26AM PDT, ID: 22139787

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 09:59AM PDT, ID: 22140054

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 10:09AM PDT, ID: 22140136

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 10:11AM PDT, ID: 22140151

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 10:52AM PDT, ID: 22140465

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 12:29PM PDT, ID: 22141265

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.01.2008 at 01:41PM PDT, ID: 22141787

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP and Databases, MySQL Server
Tags: php/mysql, IE
Sign Up Now!
Solution Provided By: jopie916
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.01.2008 at 01:46PM PDT, ID: 22141829

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628