By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,336 Members | 2,315 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,336 IT Pros & Developers. It's quick & easy.

sorting two arrays

P: n/a
this is prolly too simple but i got a brain block

i have two arrays, one is days[1-7] and the other is
timeofday[a-l],<each letter represents a time on the hour>
how do is sort by days and put each day's list in order of time?
so that i get a list in order of days and each day is in order of
time...i can put in order by day or time but they always end up with
whatever is the other order wrong.

if ( isset($_GET['sort']) && $_GET['sort']=='call_days' ) {
$_SESSION['sort'] = 'call_days'; }

if ( isset($_GET['sort']) && $_GET['sort']=='call_time' ) {
$_SESSION['sort'] = 'call_time'; }

and:

<?php if ($_SESSION['sort']!='call_time') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_time">Call Time</a>'; } else {
echo 'Call Time &darr;'; } ?>

<?php if ($_SESSION['sort']!='call_days') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_days">Call Days</a>'; } else {
echo 'Call Days &darr;'; } ?>

:-)^2
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I noticed that Message-ID:
<mB*******************@bignews4.bellsouth.net> from Terry Richards
contained the following:
i have two arrays, one is days[1-7] and the other is
timeofday[a-l],<each letter represents a time on the hour>
how do is sort by days and put each day's list in order of time?
so that i get a list in order of days and each day is in order of
time...i can put in order by day or time but they always end up with
whatever is the other order wrong.

if ( isset($_GET['sort']) && $_GET['sort']=='call_days' ) {
$_SESSION['sort'] = 'call_days'; }

if ( isset($_GET['sort']) && $_GET['sort']=='call_time' ) {
$_SESSION['sort'] = 'call_time'; }

and:

<?php if ($_SESSION['sort']!='call_time') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_time">Call Time</a>'; } else {
echo 'Call Time &darr;'; } ?>

<?php if ($_SESSION['sort']!='call_days') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_days">Call Days</a>'; } else {
echo 'Call Days &darr;'; } ?>


Maybe I have brain block too but that code seems to have nothing to do
with the question.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2

P: n/a
Geoff Berrow wrote:
I noticed that Message-ID:
<mB*******************@bignews4.bellsouth.net> from Terry Richards
contained the following:

i have two arrays, one is days[1-7] and the other is
timeofday[a-l],<each letter represents a time on the hour>
how do is sort by days and put each day's list in order of time?
so that i get a list in order of days and each day is in order of
time...i can put in order by day or time but they always end up with
whatever is the other order wrong.

if ( isset($_GET['sort']) && $_GET['sort']=='call_days' ) {
$_SESSION['sort'] = 'call_days'; }

if ( isset($_GET['sort']) && $_GET['sort']=='call_time' ) {
$_SESSION['sort'] = 'call_time'; }

and:

<?php if ($_SESSION['sort']!='call_time') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_time">Call Time</a>'; } else {
echo 'Call Time &darr;'; } ?>

<?php if ($_SESSION['sort']!='call_days') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_days">Call Days</a>'; } else {
echo 'Call Days &darr;'; } ?>

Maybe I have brain block too but that code seems to have nothing to do
with the question.


well now, what i am looking to do is explained as best as i can. what
does this code do? i am thinking i need to do for each day:
(day[1-7])(time[a-l])starting with day1-a getting a total of 72
interations ending with (day7-l)

:-)^2

Jul 17 '05 #3

P: n/a
Terry Richards wrote:
Geoff Berrow wrote:
I noticed that Message-ID:
<mB*******************@bignews4.bellsouth.net> from Terry Richards
contained the following:

i have two arrays, one is days[1-7] and the other is
timeofday[a-l],<each letter represents a time on the hour>
how do is sort by days and put each day's list in order of time?
so that i get a list in order of days and each day is in order of
time...i can put in order by day or time but they always end up with
whatever is the other order wrong.

if ( isset($_GET['sort']) && $_GET['sort']=='call_days' ) {
$_SESSION['sort'] = 'call_days'; }

if ( isset($_GET['sort']) && $_GET['sort']=='call_time' ) {
$_SESSION['sort'] = 'call_time'; }

and:

<?php if ($_SESSION['sort']!='call_time') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_time">Call Time</a>'; } else
{ echo 'Call Time &darr;'; } ?>

<?php if ($_SESSION['sort']!='call_days') { echo '<a
href="',$_SERVER['PHP_SELF'],'?sort=call_days">Call Days</a>'; } else
{ echo 'Call Days &darr;'; } ?>


Maybe I have brain block too but that code seems to have nothing to do
with the question.

well now, what i am looking to do is explained as best as i can. what
does this code do? i am thinking i need to do for each day:
(day[1-7])(time[a-l])starting with day1-a getting a total of 72
interations ending with (day7-l)


That makes it clear as a pint of Guiness... Show us the code that (1)
loads the arrays and (2) sorts them.

NM

--
convert uppercase WORDS to single keystrokes to reply
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.