[wplug] MySQL help
Kevin Squire
gentgeen at wikiak.org
Mon Nov 1 08:54:23 EDT 2010
sorry for the vague title, but not even sure how to title this one
(maybe that is why Google is failing me right now also)
We are building out an "attendance" module. Everytime a kid hits the
"attendance" page (first page after login) the student's username, IP
address and Date are recorded to a DB table titled "cur_month" The
"cur_month" table is made of 4 fields:
username VARCHAR(124),
dstamp DATE,
ipaddress VARCHAR(124)
tstamp TIMESTAMP
(PRIMARY is username+dstamp)
What I need some insight for is: I need to create a "report" that would
be more teacher friendly. (think teachers gradebook) At any time, I
need to create output (csv, web, sql query, what ever) that would have
one column for each day of the month, one row for each username. Is
there a single MySQL command that I could use for that? Or would this
be a loop in PHP to loop through the days of the the month?
The only thing that comes to mind right now for me is a php script that
would:
a) Look for all unique "username" feed that into an array
b) Loop through "username array" looking for dates (SELECT
username,dstamp WHERE username='') and feed that into a multi-dem
array
c) Spit out the multi-dem array in required format
I know this just might be the only way... but looking for any other
ideas you all might have.
--
http://www.wikiak.org
#############################################################
Associate yourself with men of good quality if you esteem
your own reputation; for 'tis better to be alone then in bad
company. - George Washington, Rules of Civility
More information about the wplug
mailing list