Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 24th, 2003, 04:25 PM
mdhall mdhall is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 158 mdhall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
paged search results

Not sure if this is a PHP or MySql question, but here goes.

I'm using a php script to page mysql search results by category. A user uses a form and selects a category to see all the listings in that category, and the result page shows 15 listings, with the next/previous links, number of listing for that category, etc., as it should. However, when you click on the "next" link, and then afterwards click on any link, it brings up all of the listings in the database, not just the ones for that category.
Here is the code, any suggestions on what is causing this?

php Code:
Original - php Code
  1.  
  2. <html>
  3. <head>
  4. </head>
  5. <body bgcolor=white link=#004679 alink=black vlink=black><center>
  6.  
  7. <?
  8. require("paging_class.php");
  9. include("dbinfo.inc.php");
  10. $paging=new paging(15,5);
  11. $paging->db("localhost","$username","$password","$database");
  12. $paging->query("select * from links WHERE category LIKE '%$list%' ORDER BY name ASC");
  13. echo "<table width=380 border=0 cellpadding=8 cellspacing=0>";
  14.  echo "<tr>";
  15.                  echo "<td valign=top align=center><font face=verdana size=2 color=#004679><b>";
  16. $page=$paging->print_info();
  17.     echo "<p>Listings $page[start] - $page[end] of $page[total]<br> [Total of $page[total_pages] Pages]<hr>n";
  18.  echo "</b></font></td></tr>";
  19. while ($result=$paging->result_assoc()) {
  20.                
  21.                  echo "<tr>";
  22.                  echo "<td><font face=verdana size=1 color=black><b>";
  23.     echo $paging->print_no()." : ";
  24.     echo "$result[name]<br>n";
  25.                   echo "<a href=$result[web] target=_parent>Link to Website</a><br>n";
  26.                   echo "$result[description]<br>n";
  27.                  
  28. }
  29.  
  30. echo "<hr>".$paging->print_link();
  31.  
  32. ?>
  33. </body></html>


This is online now, if viewing it actually working will help someone figure it out.
<mdhwebdesign.com/tstop/index.shtml>View Online</a>, look under the business directory and search the categories.

Thnx


Reply With Quote
  #2  
Old September 24th, 2003, 04:27 PM
mdhall mdhall is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 158 mdhall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: paged search results

Sorry, heres the link...
<a href=mdhwebdesign.com/tstop/index.shtml>View Here</a>

Reply With Quote
  #3  
Old September 24th, 2003, 05:39 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RE: paged search results

the problem is that the next and previous links are not passing the catagory originally chosen to the subsequent queries, so the query is then pulling all the results. if you select the next or previous (or any indivdual page) link, I believe the query looks like this...

select * from links WHERE category LIKE '%%' ORDER BY name ASC");

this query would return every entry in the db. Try echoing the query to see what is being generated.


Reply With Quote
  #4  
Old September 24th, 2003, 06:42 PM
mdhall mdhall is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 158 mdhall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: paged search results

What would keep it from passing the query, and what would I change to do so?

Reply With Quote
  #5  
Old September 24th, 2003, 07:33 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RE: paged search results

look at the next and previous links that are created and you will see that the list variable and its value do not exist in the link. You would need to add the list variable (and its value) to the next and previous links. Data does not automatically persist from page to page, you either have to use a session variable or pass the value in the query string.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > paged search results


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 12 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek