in reply to Cookies or maybe another way to do it.....
I think you want something like this. Note use ? placeholders to ensure values get correctly quoted or you have a big security hole. if ( $val ) {} elsif ( ! $val ) {} is an if/else - there are no other options.
if ( $cookie{host}->value ) { $db->do( "UPDATE logs SET visits = visits + 1 WHERE host = ?", $co +okie{host}->value ) or die $db->errstr; } else { $db->do( "INSERT INTO logs VALUES (?, ?, 'index', 1)", $host, $xron +os ) or die $db->errstr; }
cheers
tachyon
|
|---|