in reply to Re^7: Making an automatic counter adder for all webpages
in thread Making an automatic counter adder for all webpages
I didn't knew i could pass variables as arguments to $db->do(...) like that, i was under the impression that i only was used when one had a fixed mysql statement with all arguments known (no vars)! If not i was using prepare and execute, i mean in case of unknown variables like '?' for '$pagename'. Can the 'undef' be ommited too as 'statemnt,,@bind_vars' ? The 'undef' is still a mystery to me on what it does although i read the help section.
Another question is that i didnt understand why you uses this version of select:
If i wanted to dot he same i would do something like:my ($counter) = $db->selectrow_array( 'SELECT pagecounter FROM counters WHERE pagename = ?', undef, $pagename );
ormy $counter = 'SELECT pagecounter FROM counters WHERE pagename = ?' +, undef, $pagename );
Why the need for ($counter) and the method $db->selectrow_array ?my $sth = $db->prepare('SELECT pagecounter FROM counters WHERE pagenam +e = ?'); $sth->execute($pagename);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Making an automatic counter adder for all webpages
by polettix (Vicar) on Dec 24, 2007 at 12:45 UTC | |
|