Re: 2 times same query, once with limits
From: Bob Bedford (bedford1_at_YouKnowWhatToDoHerehotmail.com)
Date: 01/21/05
- Next message: Tony Marston: "Re: Nested classes in PHP?"
- Previous message: varois83: "Re: Is it ok to use error_reporting(0) to get rid of error m"
- In reply to: Erwin Moller: "Re: 2 times same query, once with limits"
- Next in thread: Virgil Green: "Re: 2 times same query, once with limits"
- Reply: Virgil Green: "Re: 2 times same query, once with limits"
- Reply: Chung Leong: "Re: 2 times same query, once with limits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 21 Jan 2005 18:56:54 +0100
"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> a écrit dans
le message de news: 41f131a9$0$6211$e4fe514c@news.xs4all.nl...
> Bob Bedford wrote:
>
>> I've a query quite important to execute.
>>
>> I've to fill an array with all result, so the query is called once wich
>> returns all ID's
>>
>> Then I call the same query a second time as I shown only 10 results in my
>> page.
>>
>> How can I avoid to call the query twice ?
>>
>> Bob
>
> Hi Bob,
>
> you didn't mention if you want to use both results on the same page.
> If so:
> - Loop over ALL the results once.
> - Then loop over the first 10
>
> If you want the results to be available on another page, store them in a
> session.
I want 10 results (not necessarely the first 10) in the actual page. In the
other page, I need only 1 result BUT I've to know previous and next record.
Takes this example. I'm in the search page. The result gives 150 results. I
only show 10 results/page.
Now, I click on an element (one of the result). From there I'd like to click
on "next item" or "previous item".
For this I've to know each element of the query's result. But how to do
previous and next ??? now I've executed the query, then I put each element
ID in an array. When I go in element page, I have the array, so clicking on
previous I've the previous ID, clicking on next, I've the next ID. Then I
show the element with the new ID.
The problem is that If I click 12 times on "next", I've to know that
clicking on "return" button (not the previous of the browser), the page has
changed. I should be in page 2 now.
How to fill the array then show only 10 results ? What should I do ?
Bob
- Next message: Tony Marston: "Re: Nested classes in PHP?"
- Previous message: varois83: "Re: Is it ok to use error_reporting(0) to get rid of error m"
- In reply to: Erwin Moller: "Re: 2 times same query, once with limits"
- Next in thread: Virgil Green: "Re: 2 times same query, once with limits"
- Reply: Virgil Green: "Re: 2 times same query, once with limits"
- Reply: Chung Leong: "Re: 2 times same query, once with limits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]