On Oct 29, 2009, at 6:15 PM, 田口 浩 wrote:
Hello,
Is there a way to insert TIMESTAMP data or null
by 1 SQL?
$stmt = "INSERT INTO T_TAB1_T (C1, MEMO, T1) VALUES(?,?,?)";
This cannot insert null data.
The simplest way around this is to prepare two statements:
$stmt = "INSERT INTO T_TAB1_T (C1, MEMO, T1) VALUES(?,?,TIMESTAMP(?))";
$stmt2 = "INSERT INTO T_TAB1_T (C1, MEMO) VALUES(?,?)";
$sth = $dbh->prepare($stmt);
$sth2 = $dbh->prepare($stmt2);
then in your while loop, test for T1
if ($T1) {
$sth->execute($c1, $memo, $t1);
}
else {
$sth2->execute($c1, $memo);
}
--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group
Institutions do not have opinions, merely customs