Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating Next, Last, First & Previous links on an array.

Explorer ,
Dec 11, 2006 Dec 11, 2006
I have a function that I am using a do>whille loop on a recordset to give me distances and putting them in an array. I need to sort that by the out putted data and displays them in groups of 10 (as you would do in a dating site).

First I've setup a recordset that I loop through to create the distance array:

do {
//CREATE THE ARRAY USING THE USERNAME FROM RECORDSET
$z['username'][$k] = $row_rsUSERIDID['username'];
//MY DISTANCE CALUATION FUNCTION
$z['distance'][$k++] = $totaldist;
} while ($row_rsUSERIDID = mysql_fetch_assoc($rsUSERIDID));

//SET NEW ARRAY
$z['user'] = $z['username'];

//SORT BY DISTANCES
natsort ($z['distance']);
reset ($z['distance']);

//DISPLAY ARRAY
foreach($z['distance'] as $k => $v){
$newuser = "{$z['user'][$k]}";
if ($v <= $dist_from) {
include("user.inc.php");
}
}

All this works fine, expect that I want to limit the number items in the arrary to 10 and have next, last, previous & first links on the page like you would with a recordset. Anyone have any ideas how to go about doing that?

Thanks
TOPICS
Server side applications
343
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 11, 2006 Dec 11, 2006
On Mon, 11 Dec 2006 17:10:17 +0000 (UTC), "VernMan"
<webforumsuser@macromedia.com> wrote:

> All this works fine, expect that I want to limit the number items in the
>arrary to 10 and have next, last, previous & first links on the page like you
>would with a recordset. Anyone have any ideas how to go about doing that?

I use this extension by Tom Muck - very good value.

http://www.tom-muck.com/extensions/help/RecordsetNavigationSuite/

--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 12, 2006 Dec 12, 2006
LATEST
That would be beautiful if there was an extension I could use, but according to Tom this would not suit my needs. This requires some hand coding that is a little beyond me. Problem is his extension only works with recordsets that Dreamweaver has created. I am creating an array from a recordset and now need to create a navigation tool based on the arrary and not the recordset.

Anyone else?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines