Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing record set to another page 1

Status
Not open for further replies.

rhowes

IS-IT--Management
Jun 6, 2001
140
ZA
Hi

I have a search page which does a database query on MySql and returns a record set:

$result = $db->query($sql)

I step through this result step with:

while ($row->record()) {
//write records
}

What I want to know is how can I pass the recordset onto another page. Each record written above has a link, but in the new page (showing the record details) I want to be able to move backwards and forwards through my search results.

Can I pass my search results (record set) to the called page?

Thanks in advance.
Cheers

Richard
 
why you dont use javascript?

javascript.history(-1) ? to go back and javascript.history(1) to move forward? Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Hi Anikin

Thanks for your suggestion, but I havent explained myself well, sorry.

I have a search page (contact_search.php) which performs a search, on contacts in my database for example. Contacts can be filtered by type on the search (like only guests, agents etc.) and you can search using wildcards.

Say I search on guests like this "Last Name: bro*" and get the following result table.

Brown Richard Guest
Brown Jill Guest
Brown John Guest

I can click either line in my table and another page loads with a for containing all details for the contact (Address details etc. - about twenty fields).

Say I click the first one and go to another page (contact_details.php). On that page I have two buttons for navigating between records on my result set (in this case the three contacts names Brown). So if I click the right_arrow button I want to reload contact_details.php but with "Brown, Jill". If I click it again I get "Brown, John" - etc. and so on.

What I need to be able to do is pass the recordset from contact_search.php to contact_details.php. I even tried passing the sql statement I used to generate the search so I could redo the search on contact_details.php but I had problems with this too (all characters after certain other characters (like % or ') in the sql would not be passed.

Any other ideas?

Thanks again.
Richard
 
Does all records have id's? Then you are able to browse through the record set by just providing the id in contact_detail.php.
However you want to browse through the sorted records i guess. Then keep the id thin but send an array containing the sortednumbers with it.
This is done with serialize.
In this manner you dont have to pass each recordset, but just the id's and on each new contact_detail.php page you query the db again.
Hope this helps. mcvdmvs
-- "It never hurts to help" -- Eek the Cat
 
Hi mcvdmvs

Thank you for your advice, it was just the solution I needed (and answered a few other questions as well!).

Thanks again.
Cheers

Richard
(Johannesburg, South Africa)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top