Page 1 of 1

PHP Search Results

Posted: Tue Sep 20, 2005 4:13 am
by jescobar
I am very new at this but seem to be understanding PHP more and more everyday. However there are just certain things I don't know!! (go figure :lol: )

Well here is the question I have, I am creating a code for a community I have. Attendance was becoming an issue so we decided to keep track of it, so here is the example of the values stored on MySQL db.

Username
jescobar

Event Status (options)
Present
Late
Excused Absence
Unexcused Absence


Now when we are going to pull the reports I can get the date and see the status of ALL the members for that one date, is there a way for me to search for a single member and see all the values entered for that member?

i.e. if there is a total of 10 events the values for a member in particular would come out to be like...

Username = jescobar

Present = 5
Late = 2
Excused Absence = 2
Unexcused Absence = 1

I'm sure with the power of php such thing can be achieved but I have no clue where to start :(

Any help would be greatly appreciated!!!

Thanks,
J.

Posted: Tue Sep 20, 2005 4:28 am
by n00b Saibot
jescobar wrote:I'm sure with the power of php such thing can be achieved but I have no clue where to start :(
it would have to power of MySQL in your case :wink:

Please post your SQL statement/DB Schema
I figure it would be something like

Code: Select all

SELECT COUNT(Present) as Present, COUNT(Late) as Late, COUNT(Excused) as Excused, COUNT(Unexcused) as Unexcused FROM events WHERE username='jescobar' GROUP BY username

Posted: Thu Sep 22, 2005 1:43 pm
by jescobar
Thanks for the reply, but how am I able to write this in a search query?