[PHP] What is the best way to reorder table columns...temp tables?

2001-12-14 Thread J. Roberts

I'm trying to update a report generator I have, using php and mysql.
The setup is essentially listing employees and production data.

What I did when I created it was for the column headers, made them links
to requery the database..sample link follows (inside an anchor tag):
"reports.php?userid=&date_start=&date_end=&orderby=trans_per_req%20desc&groupby=&type=other&daterange="

As you can see that is very ugly, and inefficient.

I was thinking that one way to get around passing so many parameters was
after the initial query, have that inserted into a temporary table.  Then
all that would need to be passed with the query string would be an ORDER BY
clause, at which time I would do a SELECT * FROM TEMP_TABLE ORDER BY
$orderby.

One thing im not sure about, is if temporary tables are unique to each user.
That is to say if two people were running reports at the same time with
different
parameters, would that work?  If so, how long before the connection dies?
If
it is at the end of script execution, that wouldn't be much help.

Does anyone have any better ideas as well?  I thought about using a
multi-dimensional
array, but was told that that would be a bad idea to keep a large array
alive
in memory.

Thanks,

-Jamison

(hope this makes some sense)






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Sorting Multidimensional Array..second dimension has 12 elements

2001-12-08 Thread J. Roberts

I have a 2 dimensional array...with the second dimension having 
12 elements.  What I want to do is sort (and re-sort) they array
by one of the 12 elements...keeping data consistent.

All of the examples I have read @php.net seem to deal with 
multidim-arrays that only have one element in them.

Here is a cut-n-paste of a print_r() of my array:
-begin paste--
Array
(
[barnhij] => Array
(
[name] => Jeremy Barnhill
[toi] => 5855
[pdk] => 1456
[tpdk_trans] => 40169
[tpallm_trans] => 17430
[terrors] => 174
[total_trans] => 57599
[pct] => 97.03
[modpct] => 98.3630
[pdk_pct] => 69.74
[pallm_pct] => 30.26
[trans_per_req] => 9.84
)

[clarkm10] => Array
(
[name] => Michelle Clark
[toi] => 1971
[pdk] => 402
[tpdk_trans] => 15427
[tpallm_trans] => 9970
[terrors] => 97
[total_trans] => 25397
[pct] => 95.08
[modpct] => 97.3484
[pdk_pct] => 60.74
[pallm_pct] => 39.26
[trans_per_req] => 12.89
)

[humphrj5] => Array
(
[name] => Jill Humphries
[toi] => 6104
[pdk] => 1002
[tpdk_trans] => 42759
[tpallm_trans] => 28907
[terrors] => 125
[total_trans] => 71666
[pct] => 97.95
[modpct] => 98.8889
[pdk_pct] => 59.66
[pallm_pct] => 40.34
[trans_per_req] => 11.74
)

[roberj15] => Array
(
[name] => Jamison Roberts
[toi] => 7132
[pdk] => 1524
[tpdk_trans] => 52542
[tpallm_trans] => 42311
[terrors] => 46
[total_trans] => 94853
[pct] => 99.36
[modpct] => 99.6533
[pdk_pct] => 55.39
[pallm_pct] => 44.61
[trans_per_req] => 13.30
)

)

---end paste-

Hope this is clear,
Thanks - Jamison.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Creating multidimensional array dynamically

2001-12-06 Thread J. Roberts

I can't seem to figure out how to create a multidimensional array from
a database query.  Here is an example of what I was looking for, using
NFL quarterbacks as a statistical foundation...
A record contains the following fields:

NAME, ATTEMPTS, COMPLETIONS, YARDS, TD, INT

Now I would like to be able to create an array with NAME as a key containing
the array(ATTEMPTS, COMPLETIONS, YARDS, TD, INT).

That way I would be able to do the following:

echo $quarterbacks["GARCIA"]["YARDS"];

and get the output of 3,100 or whatever the case may be.

Thanks,
-Jamison.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]