PHP Search Results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jescobar
Forum Newbie
Posts: 24
Joined: Mon Jun 06, 2005 4:14 am

PHP Search Results

Post 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.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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
User avatar
jescobar
Forum Newbie
Posts: 24
Joined: Mon Jun 06, 2005 4:14 am

Post by jescobar »

Thanks for the reply, but how am I able to write this in a search query?
Post Reply