Print evaluated query string using ADODB/PHP
Snippet
Written with a loving hand by kitt some time around 14:10 on 12 October 2009
After a parameterized querystring has been evaluated, but before the query has been run, print out the query string, using ADODB PHP library.
<?php /* * include the ADODB library */ include('adodb.inc.php'); /* * Make a new connection to DB */ $mydb = &ADONewConnection('access'); $mydb->PConnect('northwind'); /* * filter input */ $shipto = $conn->qstr("John's Old Shoppe"); /* * generate SQL */ $sql = "insert into orders (customerID,EmployeeID,OrderDate,ShipName) "; $sql .= "values ('ANATR',2,".$mydb->FormatDate(time()).",?)"; /* * * * PRINT THE SQL BEFORE EXECUTING THE QUERY * * */ $mydb->debug = true; if ($mydb->Execute($sql, $shipto) === false) print 'error inserting'; ?>
Source:
Add new comment