I have an online form which collects consumer data and stores in a dedicated MySQL database. In some instances, data is passed in the URL under the “RefID” variable which is also stored in the database and attached to each registration.
I use the ‘mysql_num_rows ($result)’ to fetch all agent details on another page but this only returns ALL available details. My goal is as follows:
GOAL
I want to create an HTML table in which rows are automatically generated based on the list of all registrations on my site. A new row is created IF and ONLY IF a unique RefID is present on that particular record. In the event the field is NULL, it is reported on a single line.
In short, the HTML table could look something like this:
RefID – Number of Enrollments
abc123 – 10
baseball – 11
twonk – 7
NULL – 33
Where abc123 is a particular RefID and 10 is the number of times that RefID appears in the DB. If a new registration comes in with RefID = “horses”, a new row is created, showing “horses – 1”. The HTML table will be viewable by account administrators needing to see the number of enrollments for a particular RefID (which they won’t know ahead of time).
Anybody have any suggestions?
I think this is what you want, I’ve test it and returns correct values:
If its not the solution to your problem, just let me know, I’ll try to help better!