Article 539S2 totally confused - sorting database records

totally confused - sorting database records

by
pizzipie
from LinuxQuestions.org on (#539S2)
Hi,

I am trying to sort many records of a database on the 'InvDate' field.

I have tried most of the PHP array sort functons and have gotten nowhere.

Here are sample records: *** The $rows array 'InvDate' fields have been converted from mm/dd/yyy format to strtotime() values.

The PHP examples are not very good I don't need to sort apples and oranges so hope someone can show a real life solution for my confusion.

Thanks in advance,
R

Code: $rows[15] => Array
(
[Id] => 16
[AcctFor] => polly
[InvDate] => 1581145200 *** <=======
[OrderNo] =>
[DrugNo] =>
[Description] =>
[Cost] =>
[ReFills] =>
)

$rows[16] => Array
(
[Id] => 17
[AcctFor] => dog
[InvDate] => 1581404400
[OrderNo] =>
[DrugNo] =>
[Description] =>
[Cost] =>
[ReFills] =>
)

$Rows[17] => Array
(
[Id] => 24
[AcctFor] => new insert
[InvDate] => 1126764000
[OrderNo] => 2887
[DrugNo] => q34
[Description] => some bizare stuff
[Cost] => 9
[ReFills] => 3
)

$rows[18] => Array
(
[Id] => 25
[AcctFor] => george
[InvDate] => -1076864400
[OrderNo] => X36-TY7
[DrugNo] => 5800
[Description] => Asprin
[Cost] => 4
[ReFills] => 3
)here are the corresponding dates in sorted order
Code:(
$dates[0] => -1076864400
ditto[1] => 1126764000
ditto[2] => 1581145200
and[3] => 1581145200
so[4] => 1581404400
on[5] => 1581490800
[6] => 1581490800
[7] => 1581490800
[8] => 1581490800
[9] => 1581663600
[10] => 1581663600
[11] => 1581663600
[12] => 1581663600
[13] => 1581663600
[14] => 1581663600
[15] => 1581663600
[16] => 1581663600
[17] => 1588312800
[18] => 1588312800
)latest?d=yIl2AUoC8zA latest?i=05vCvg-SiFw:M_W-Uiza7-A:F7zBnMy latest?i=05vCvg-SiFw:M_W-Uiza7-A:V_sGLiP latest?d=qj6IDK7rITs latest?i=05vCvg-SiFw:M_W-Uiza7-A:gIN9vFw05vCvg-SiFw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments