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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use Date::Calc qw(:all);

Status
Not open for further replies.

vintl

Technical User
Joined
Jun 9, 2000
Messages
72
Location
MY
how can i use the Today_and_Now() function for my INSERT stmt?
my stmt seems correct..but, it gives this error
DBD::mysql::st execute failed: You have an error in your SQL syntax near ''',NOW())' at line 1

$stmt = "INSERT INTO TB_LEAVE_RECORD VALUES(?,?,?,?,?,?,?,NOW())";
$sth = $dbh->prepare($stmt);
$sth->execute($D_EMPLOYEE_ID,$F_LEAVE_TYPE_ID,$F_DAY,$F_START_DATE,$F_END_DATE,$F_STATUS_ID,$F_REASON);
$sth->finish;
 
I can't see anything wrong with the sql statement, but you might try using now() instead of NOW(). I almost always use lowercase in my sql, and the now() function works for me (using MySQL).
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
You also need to make sure that you have exactly as many values in the values list as there are fields in the table, and that they are in the exact same order as the fields in the table. Either that, or put a list of field names (in parens) before the values clause.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top