CodeIgniter Forums
A Rather Challenging Pagination Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: A Rather Challenging Pagination Problem (/showthread.php?tid=25920)

Pages: 1 2


A Rather Challenging Pagination Problem - El Forum - 01-03-2010

[eluser]BrianDHall[/eluser]
[quote author="djreed" date="1262313240"]Ah! Shoulda known this. Thank you! However, can I attach two arrays such as a database result to another array in this way? In other words, $result is already an array - $result['id'], $result['businessname'], $result['url'] are all contained within $result. So in this case what happens when:

Code:
$array[]=$result

And how would I access the results?[/quote]

You'll get a multi-dimensional array, so the first element of $array will be $result, which is an array, and the second element of $array will be the second $result, which is an array.

So to access it would be $array[0]['id] and $array[1]['id'] - this can go infinately deep, so in theory you could built something that looks like this: $array[1]['id'][0][2]['go_fish'], I just don't recommend it Smile


A Rather Challenging Pagination Problem - El Forum - 01-04-2010

[eluser]Fabdrol[/eluser]
Don't think you need a session, you could just use an URL.
Like this: user submits the first results using $_POST, your controller does something to it and then redirect() 's to an method which takes the ZIP code as an param, and the result id, and the page number, for instance.

Think you can work from there, or do you need some code examples?

-- Fabian


A Rather Challenging Pagination Problem - El Forum - 01-04-2010

[eluser]djreed[/eluser]
No that's perfect. Thanks guys. Appreciate it!

I'm actually thinking of storing the zip code query using Codeigniter's flashdata (http://ellislab.com/codeigniter/user-guide/libraries/sessions.html).


A Rather Challenging Pagination Problem - El Forum - 01-04-2010

[eluser]Fabdrol[/eluser]
Don't you think it will be a good thing, in terms of the user experience, that users can access the app directly using the url, like..
http://www.delivery.com/companies/96703/

then users don't need to use your application's interface évery time, they can just browse to the results right away!

cheers!


A Rather Challenging Pagination Problem - El Forum - 01-04-2010

[eluser]djreed[/eluser]
That makes sense definitely. I'll seriously consider that option if I can figure out how to implement it.