topical media & game development
professional-search-14-seophp-include-catalog.inc.php / php
<?php
// load configuration file
require_once('config.inc.php');
// load database tools
require_once('database_tools.inc.php');
// Database class for handling brands
class Brands
{
// retrieve cloaking data filtered by the supplied parameters
function get(name = '', order_dir = '')
{
// by default, retrieve all records
id) {
id;
id ";
}
// filter by brand name
if (name = mysql_escape_string(q .= " AND name = 'order_by) {
if (order_dir) {
order_q = ' ';
}
order) . db_link = DatabaseTools::getConnection();
// execute the query
q);
// close database connection
DatabaseTools::closeConnection(rows = array();
while (query_results)) {
result;
}
return id = 0, order_by = '', q = " SELECT categories.* FROM categories WHERE TRUE ";
// filter by category id
if (id = (int) q .= " AND id = name) {
name);
name' ";
}
// add sorting options
if (order_dir !== '' && !order_q = ' DESC ';
} else {
q .= " ORDER BY " . DatabaseTools::dbIdentifier(order_q;
}
// get a database connection
query_results = mysql_query(db_link);
// return the results as an associative array
result = mysql_fetch_assoc(rows[] = rows;
}
}
// Database class for handling products
class Products
{
// retrieves products data filtered by the supplied parameters
function get(category_id = 0, name = '')
{
// by default, retrieve all records
id parameter was provided
if (id = (int) q .= " AND id = name parameter was provided
if (name = mysql_escape_string(q .= " AND name = 'category_id) {
category_id;
category_id) ";
}
// filter by brand ID if the
if (brand_id) {
brand_id;
brand_id ";
}
// get a database connection
query_results = mysql_query(db_link);
// return the results as an associative array
result = mysql_fetch_assoc(rows[] = rows;
}
}
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.