values in the constructor of the extended class too if you were working with multiple databases.
implement. The SELECT queries are made to allow you to append your own WHERE clause parameters, ORDER BY
clauses and LIMIT clauses (for mySQL). The data manipulation SQL statements are formatted so that it takes
little extra code inside the data access methods to set the values to be inserted or updated.
var $SQL_SELECT = "SELECT * FROM `vehicles` ";
var $SQL_COUNT = "SELECT count(*) AS cnt FROM `vehicles` ";
// insert with no value for an auto_increment field.
var $SQL_INSERT = "INSERT INTO `vehicles` (year,make,model,color,price) VALUES ('%A','%B','%C','%D',%E)";
var $SQL_UPDATE = "UPDATE `vehicles` SET ";
var $SQL_DELETE = "DELETE FROM `vehicles` WHERE vehicleid=%A";
- function findByPK($vehicleid) –
- Returns a single VehicleVO object based on the $vehicle id or null if no record is found.
- function findBySQL($sql, $orderby = “”) –
- Returns an ordered array of VehicleVO’s based on a complete SQL query.
$dao= new VehicleDAO();
$volist = $dao->findBySQL("select * from vehicles where make='Ford' ", "year, model");
foreach($volist as $vo)
echo("$vo->year $vo->model $vo->color<br />");