I created this very simple Counter in Adobe Flash Professional to be displayed on our website. A working example can be viewed here: www.feralcatmonth.com/Spay-Neuter-Counter/
First, I need to get the 2 buttons when they are clicked to insert a row in a designated mySQL Database, which I have created.
There are two tables in the Database (spay_total & neuter_total) with three columns in each table (ip, clicks, datetime). This could easily be accomplished with only 1 row but I wanted to setup 'ip' as the computer's ip address. Clicks
is set to auto_increment.
Any help with these issues will be greatly appreciated. Thank you.
EDIT
I managed to get this Flash Player to work with the XML file. The XML displays the last row in the table but only grabs the clicks
column from the table. The clicks
column is set to auto-increment.
The only issue I have now is how to link the button so once it is pushed it adds a row to the database while also increasing the display box by +1.
I think the code will be something like this in Flash Actions Button:
on (press) {
INSERT INTO spay_total (ip, datetime) VALUES ('$ip', 'NOW()');
}
But I don't know how to incorporate this into the Flash Player Actions?
As of right now, I do not really care about getting the ip address of the user. I just need to get the button to insert a row into the database, then I will worry about getting the IP address.
Flash Professional Actions Frame (for reference if needed):
{
var theXML:XML = new XML();
theXML.ignoreWhite = true;
theXML.load("http://www.feralcatmonth.com/php-sql/spay_totals.php");
theXML.onLoad = function(success){
if (success){
spay_counter=this.firstChild.firstChild.firstChild;
}
};
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.load("http://www.feralcatmonth.com/php-sql/neuter_totals.php");
myXML.onLoad = function(success){
if (success){
neuter_counter=this.firstChild.firstChild.firstChild;
}
}
}
Thank you again.