http://pcbook.51soft.com/doc/adodb/index.htm
范例 3: 新增
新增一笔记录到订单资料表,里面包含了日期和字串,为了能被资料库正常存取,字串必需校正,以避免部份标记字元。例如:有单引号的字串,John's。<?
include('ADOdb.inc.php'); # load code common to ADOdb
$conn = &ADONewConnection('access'); # create a connection$conn->PConnect('northwind'); # connect to MS-Access, northwind dsn
$shipto = $conn->qstr("John's Old Shoppe");$sql = "insert into orders (customerID,EmployeeID,OrderDate,ShipName) ";
$sql .= "values ('ANATR',2,".$conn->DBDate(time()).",$shipto)";if ($conn->Execute($sql) === false) {
print 'error inserting: '.$conn->ErrorMsg().'<BR>';
}
?>
范例 3: 新增
新增一笔记录到订单资料表,里面包含了日期和字串,为了能被资料库正常存取,字串必需校正,以避免部份标记字元。例如:有单引号的字串,John's。<?
include('ADOdb.inc.php'); # load code common to ADOdb
$conn = &ADONewConnection('access'); # create a connection$conn->PConnect('northwind'); # connect to MS-Access, northwind dsn
$shipto = $conn->qstr("John's Old Shoppe");$sql = "insert into orders (customerID,EmployeeID,OrderDate,ShipName) ";
$sql .= "values ('ANATR',2,".$conn->DBDate(time()).",$shipto)";if ($conn->Execute($sql) === false) {
print 'error inserting: '.$conn->ErrorMsg().'<BR>';
}
?>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货