|more useful options|
Making an automatic counter adder for all webpagesby Nik
|on Dec 22, 2007 at 10:34 UTC||Need Help??|
Nik has asked for the
wisdom of the Perl Monks concerning the following question:
The following code connect to my db, graps the counter field value which holds an integer that represents the total amount of hits in index.pl
What must be add to this code that is able to save each unique webpage counter at a specific mysql table field adding 1 every time and also do this for every new page i create because the number of the pages aren't fixed plz post it here.
The code also has to be able to modify mysql table 'guestlog' and add a new table field every time a new page is loaded that doesnt have a corresponding counter by means of table field named as the page itself holding an integer value.
For example if a user opens index.html then connect to mysql and to table counter, find index filed add 1 to it!
if a page named hello.html its loades try to add 1 to its table filed too if it does not exist, alter the table structure by adding 1 more field with the same name of the webpage and then add 1 too.
For example it the name is hello.html then the corresponing table filed has to be 'hello' with an integer value of one.
That way one can use the code in every new webpage he creates without dropping and creating a bigger mysql table.
is this possible?