flaab Posted February 25, 2007 Share Posted February 25, 2007 Hello 2all =) I'll go straigh to the point. I'm programming a little search engine for my site. The search function returns an array with the ID's of the databases retrievals for the users criteria. Example: $retrievals = array(2,56,57,190,257,346,...,whatever); And i want to split the results to view only 20 per page. So, i need to pass that array as a parameter for an url. Example: <a href="whatever.php?retrievals=<?php print $retrievals; ?> And let the array be received by another document. How can i do that? Is there a better way to do this? Thanks a lot. Quote Link to comment Share on other sites More sharing options...
Archadian Posted February 25, 2007 Share Posted February 25, 2007 you might just have to pass the array through the URL then break up the array on the desired script. Never heard of this before but its worth a try Quote Link to comment Share on other sites More sharing options...
flaab Posted February 25, 2007 Author Share Posted February 25, 2007 Nope...could you be a little more specific? =) U mean converting the array to string...and then joining it back? Quote Link to comment Share on other sites More sharing options...
flaab Posted February 25, 2007 Author Share Posted February 25, 2007 Solved. I pass a string made like this: $string = implode(",",$array); And then I explode it again. Thanks. Quote Link to comment Share on other sites More sharing options...
itsmeArry Posted February 27, 2007 Share Posted February 27, 2007 A better approach what I think would br serialize it and then unserialize it on next paga $strRetrievals = serialize($retrievals); <a href="whatever.php?retrievals=<?php print $strRetrievals; ?> and on next page you can use $strRetrievals = $_GET['retrievals']; $arrRetrievals = unserialize($strRetrievals); hope you find it useful for future use..... Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted February 27, 2007 Share Posted February 27, 2007 actually, what you're talking about doing is called pagination, which is done an entirely different way... use the search tool on the forums. Quote Link to comment Share on other sites More sharing options...
magnetica Posted February 27, 2007 Share Posted February 27, 2007 If I understand correctly you are better doing for loop Google PHP for loops Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.