How do I get a count |
4/19/2011 8:59:40 AM |
PHPRunner General questions | |
H
horsey_kim author
Is there a way to have a count of how many items someone selects in one field? |
|
S
|
swanside 4/20/2011 |
Is there a way to have a count of how many items someone selects in one field? I have set up a field to save multiple items that the person checks (used lookup wizard and am using the checkbox feature). If they select 5 items or 10, I like to store that number in the database. Then I can determine what value goes in cost field. Example if they select 3 classes at $10 per class then their cost is $30 and I store that in the cost field. Been searching manual and forum, nothing found yet. any suggestions greatly appreciated <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=57762&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> My fields would be class (check list) count (number of classes checked) cost (class x count)
|
S
|
swanside 4/20/2011 |
I would just do it in the SQL Query at the beginneing. SO I would have something like SELECT class, count, class*count AS cost FROM table_name Would you mean like this http://demo.asprunner.net/pggrimes_hotmail_com/cost/items_list.php
|
H
|
horsey_kim author 4/20/2011 |
Sorry, I see what you mean now, I read it as Glasses that you drink from I take it you mean class as in education? Sorry
|
S
|
swanside 4/20/2011 |
yes classes as education. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=57772&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> Question, if I do this at sql level, in the beginning, how does it know what the count field will have? At the add screen, I need the count field to count the number of classes that were checked in the class field (multiple check box field based on lookup wizard). With that info then I can tell the cost field to calculate a total. I was going to use a snippet to add the cost field total to the database when they submit their information from the add screen. What I need is some way for the count to happen and record during add process. Does this make sense? Sorry this is confusing, just not sure how to present what I am trying to do.
|
H
|
horsey_kim author 4/21/2011 |
Add screen - before record added event: |