Hi,
I would like to know if it is possible to create a table that tells us the number of time a town(from the pr-epopulated town drop down menu) has been registered.
IE:
I have a form with pre-populated town names. I would really like to see:
Town 1 = 34 people
Town 2 = 56 people
Town 3 = 57 people
Town 4 = 65 people
At the moment I have a database with:
ID | Town | Surname | Last Name | Email
With my research it seems that something like this could work:
"SELECT count(city) as count, city FROM table_name GROUP BY city ORDER BY count"
But where to actually put it in app gini? Any idea please?
Also how to re-use the same field into another table so I can output all the towns and their GROUP values?
Thank you.
Ben
How to count number of towns in registrations
Re: How to count number of towns in registrations
You may add a field say Count in another table say TownList. then add the following function in _global.php
Then call this function in registration_table_name hook file (ref: http://bigprof.com/appgini/help/advance ... ific-hooks)
within the hook functions tablename_after_insert() and tablename_after_update()
Hope this help.
Code: Select all
function updatePeopleCountByTown($TownID){
// update people registered by Town
$TownID=makeSafe($TownID);
$Count=sqlValue("select count(ID) from registration_table_name where Town='$TownID' ");
sql("update CityList set Count='$Count' where Town ='$TownID' ", $eo);
}
within the hook functions tablename_after_insert() and tablename_after_update()
Hope this help.
Re: How to count number of towns in registrations
Hi wplim,
Thank you so much for your reply.
I would like to know what is the difference between Makesafe and Mysql_real_escapte_string please? Are they different? I cannot really find much good info on Makesafe.
Regarding the graphs, I have just highcharts, it was a bit of a pain to setup but it works great.
Thanks for your help,
ben
Thank you so much for your reply.
I would like to know what is the difference between Makesafe and Mysql_real_escapte_string please? Are they different? I cannot really find much good info on Makesafe.
Regarding the graphs, I have just highcharts, it was a bit of a pain to setup but it works great.
Thanks for your help,
ben
Re: How to count number of towns in registrations
Hi Ben,
I think Ahmad created the makesafe function, which make use of Mysql_real_escapte_string function to prepares variables to be used safely inside SQL queries.
WP
I think Ahmad created the makesafe function, which make use of Mysql_real_escapte_string function to prepares variables to be used safely inside SQL queries.
WP
Re: How to count number of towns in registrations
Hi WPslim,
Thank you so much for the reply I get it now.
Thanks!
Regards,
Ben
Thank you so much for the reply I get it now.
Thanks!
Regards,
Ben
Re: How to count number of towns in registrations
Your going beyond what this program is intended for.. even though you can do it..
I would reccomend for reporting things like that you get REPORTICO.. try reportico.org to download the software.. under $30 and there is a free version and it is pretty robust working with my APPGini database.
Thanks, Tina
I would reccomend for reporting things like that you get REPORTICO.. try reportico.org to download the software.. under $30 and there is a free version and it is pretty robust working with my APPGini database.
Thanks, Tina
Tina O'Connell
Web Dev & Appgini FAN
Web Dev & Appgini FAN