- Joined
- Aug 17, 2008
- Messages
- 2,190 (0.38/day)
- Location
- Minnesota, USA
System Name | TaichiTig |
---|---|
Processor | i7 6800K |
Motherboard | ASRock X99 Taichi |
Memory | 32GB DDR4 3200 |
Video Card(s) | RTX 4070 |
Storage | SSD + Misc. HDDs in DrivePool |
Display(s) | BenQ PD3200U, Samsung C32HG70 |
Case | Antec Twelve Hundred |
Audio Device(s) | Behringer UMC404HD, LSR308, Shure SRH840, AKG K612, Etymotic HF5 |
Power Supply | Corsair 750TX |
Mouse | Logitech G502 |
Keyboard | Deck Legend Ice Tactile |
Software | Win10 |
WARNING Dumb questions and poor coding probably follow because I have no formal education in PHP. I know only what I've needed to learn (usually through reverse engineering of others' code). I'm a hardware guy, not a coder/programmer!
I have a large MySQL database of computer component specs that I maintain and refer to for my professional builds, with a table dedicated to each type of component (CPU, HDD, memory, etc.). Let's simplify this by focusing on my DDR3 memory table (comp_mem_ddr3). Then I can apply the resolution to the others.
Previously, the comp_mem_ddr3 table had a field (cl) for CAS latency expressed in clocks and another field (casns) for CAS latency expressed in nanoseconds. Because I'm freakishly obsessed with streamlining, I eliminated the casns field and have switched to calculating it from variables storing the contents of two other fields: the DDR3 speed ($mem_ddr3_chiprate) and clock latency ($mem_ddr3_cl):
$mem_ddr3_casns = round(1 / $mem_ddr3_chiprate * $mem_ddr3_cl * 2000, 1);
This is all well and good. However, now I wish to add the ability to ORDER BY any column retrieved from the MySQL query (sorting by hyperlink, ascending or descending on click in the browser). When I had a MySQL database field dedicated to casns, I could have simply used "SELECT * FROM comp_mem_ddr3 ORDER BY $orderby" for the MySQL query and then set the $orderby variable via hyperlink. Now that there is no casns field as it is calculated later, what would be the best way to get the sorting I desire?
I have a feeling this will involve arrays....
Assistance would be much appreciated; will be happy to "thank" anyone who contributes.
I have a large MySQL database of computer component specs that I maintain and refer to for my professional builds, with a table dedicated to each type of component (CPU, HDD, memory, etc.). Let's simplify this by focusing on my DDR3 memory table (comp_mem_ddr3). Then I can apply the resolution to the others.
Previously, the comp_mem_ddr3 table had a field (cl) for CAS latency expressed in clocks and another field (casns) for CAS latency expressed in nanoseconds. Because I'm freakishly obsessed with streamlining, I eliminated the casns field and have switched to calculating it from variables storing the contents of two other fields: the DDR3 speed ($mem_ddr3_chiprate) and clock latency ($mem_ddr3_cl):
$mem_ddr3_casns = round(1 / $mem_ddr3_chiprate * $mem_ddr3_cl * 2000, 1);
This is all well and good. However, now I wish to add the ability to ORDER BY any column retrieved from the MySQL query (sorting by hyperlink, ascending or descending on click in the browser). When I had a MySQL database field dedicated to casns, I could have simply used "SELECT * FROM comp_mem_ddr3 ORDER BY $orderby" for the MySQL query and then set the $orderby variable via hyperlink. Now that there is no casns field as it is calculated later, what would be the best way to get the sorting I desire?
I have a feeling this will involve arrays....
Assistance would be much appreciated; will be happy to "thank" anyone who contributes.