473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

sorting two arrays

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
3 1832
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Kirby | last post by:
Hello All I am trying to update me code to use arrays to store a group of information and I have come up with a problem sorting the multiple array :( Array trying to sort: (7 arrays put into...
7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
7
by: Karin Jensen | last post by:
Hi I am running a PHP program that connects to an Access 2000 database via ODBC: $results = odbc_exec($connection_id, $sql_select); Is it possible to sort the contents of $results? I wish to...
16
by: aruna | last post by:
Given a set of integers, how to write a program in C to sort these set of integers using C, given the following conditions a. Do not use arrays b. Do not use any comparison function like if/then...
23
by: yatindran | last post by:
hai this is my 2d array. int a = { {5,2,20,1,30,10}, {23,15,7,9,11,3}, {40,50,34,24,14,4}, {9,10,11,12,13,14}, {31,4,18,8,27,17}, {44,32,13,19,41,19}, {1,2,3,4,5,6},
10
by: Roy Gourgi | last post by:
Hi, How would I sort an array? TIA Roy
3
by: SneakyElf | last post by:
i am very green with c++ so i get stuck on very simple things anyway, i need to write a program that would read data from file (containing names of tv shows and their networks) one line at a time...
3
KevinADC
by: KevinADC | last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
5
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.