SUMMARY - Re: [PHP] Re: loading a db table into a php array from mysql
| From: | David T-G | Date: | Tue, 31 Dec 2002 20:26:21 +0000 |
| Subject: | SUMMARY - Re: [PHP] Re: loading a db table into a php array from mysql | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129797@lists.php.net to get a copy of this message | ||
Tularis, et al --
..and then David T-G said...
%
% ...and then Tularis said...
% %
% % Usually,
% % using mysql to handle your tables is *way* faster than letting php
% % handle it.
..
% %
% % In your case, you could just do a complex join I think. That would give
%
% Ahhh... A new term. Back to the books for me!
A little RTFMing later, our hero returns...
%
% % all results in one table, and you could just order that on scheduletime,
%
% That certainly would be lovely :-)
Look at that; I get out what I want in the order I'll want it in a single
query!
mysql> select substring(s.timeslot,1,13),i.fname,concat(c.fname,'
',c.lname) from personnel as i, clients as c, schedule as s where i.id
= s.instr and c.id = s.client and i.fname = 'penelope' order by timeslot;
+----------------------------+----------+-----------------------------+
| substring(s.timeslot,1,13) | fname | concat(c.fname,' ',c.lname) |
+----------------------------+----------+-----------------------------+
| 2002-12-27 06 | penelope | david t-g |
| 2002-12-27 07 | penelope | david t-g |
| 2002-12-27 08 | penelope | laura t-g |
| 2002-12-27 10 | penelope | david t-g |
+----------------------------+----------+-----------------------------+
4 rows in set (0.00 sec)
I'll probably have to refine this a bit as I also learn more about how to
use this, but I'm well on my way..
Thanks again & HAND & HNY
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!