in reply to Re^5: Making an automatic counter adder for all webpages
in thread Making an automatic counter adder for all webpages
I though i had to connect to the database table and check if the specific field is present at the table 'counters' but with the eval you give i dont have too....
Unfortunately i didn't understand how the eval() is working here and what the 'undef, $pagename)' is doing after the eval(). Inever used eval before!
Eval is trying to evaluate the statement closed within its parenthesis? Can you explain a bit more if its possible?
The $ stands for the name of the current webpage thst is running? is it with or witout the '.html'? Also because you ask we dont need to know how the current webpage loaded just its name.
in your second statemtn alsoin, the increament $db->do(), you say where pagename = ?, whats the value of ?
Also i forgot to tell you that i also need to print the current webpage's counter to the output after the increment so i need to store it in a variable called $pagecounter.$db->do( 'CREATE TABLE counters (pagename text primary key, pagecoun +ter int default 0)' ); eval { $db->do('INSERT INTO counters (pagename, pagecounter) VALUES ($, 0) +', undef, $pagename); }; $db->do('UPDATE counters SET pagecounter = pagecounter + 1 WHERE pagen +ame = ?', undef, $pagename);
print table( {class=>'info'}, Tr( td( {class=>'lime'}, a( {href=>'/cgi-bin/show.pl?name=s +howlog'}, h1( {class=>'lime'}, $host )))), Tr( td( {class=>'yellow'}, $display_date)), Tr( td( {class=>'cyan'}, $pagecounter )) );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Making an automatic counter adder for all webpages
by polettix (Vicar) on Dec 23, 2007 at 14:24 UTC | |
by Nik (Initiate) on Dec 24, 2007 at 10:34 UTC | |
by polettix (Vicar) on Dec 24, 2007 at 12:45 UTC | |
|