Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl mysql problem with NOW() 1

Status
Not open for further replies.

iluvperl

Programmer
Jan 22, 2006
107
Code:
use DBI;
my $dbh = DBI->connect("DBI:mysql:$dbase", $mysql_user, $mysql_pass) o
+r
print DBI->errstr;

  my $data = qq(INSERT INTO searches (search, engine, time) values(?,?
+,?));
  my $sth = $dbh->prepare($data);
  $sth->execute("$search", "$engine", NOW());

It says NOW() is an undefined subroutine. Any idea why?
 
The NOW function is a part of MySQL, not perl. Just include the NOW statement in your prepare statement instead of in your perl code, and it should work better.

Code:
my $data = qq(INSERT INTO searches (search, engine, time) values(?,?,NOW()));

 
star for you biran!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top