<?php
require_once( HTML_DB_CUSTOMER_QUERY_PATH . '/QueryCustomer.php' );
$sql = QueryCustomer :: get ( 'demo_customer' );
?>
<? // Which now contains the following SQL:
$sql = SELECT ` demo_customer_id `,
demo_customer .` demo_session_id `,
demo_customer .` email ` as ` Email `,
demo_customer .` contact_person ` as ` Kontakt person `,
demo_customer .` company_name ` as ` Firmanavn `,
demo_customer .` address ` as ` Adresse `,
demo_customer .` zip ` as ` Postnr `,
demo_customer .` city ` as ` By `,
demo_customer .` private_phone ` as ` Privat telefon `,
demo_customer .` mobile_phone ` as ` Mobil telefon `,
demo_customer .` business_phone ` as ` Firma telefon `,
demo_customer .` ean ` as ` EAN ` FROM ` demo_customer ` WHERE
demo_customer .` demo_session_id `= '5cb3a39002cf9566f2ba763dbce8ef96' LIMIT 400
?>
Tilbage
Skjul: Navn
QueryCustomer.php
Vis: Sample code, tutorial
QueryCustomer, Sample code, tutorial
Sådan benyttes komponenten QueryCustomer klassen
Først skal du inkludere den fil der beskriver komponenten, som en klasse fil
<?
require_once( HTML_PACKAGE_PATH . '/QueryCustomer.php' );
?>
Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):
<?
QueryCustomer :: display ( $param1 , $param2 , $param3 , ...);
?>
eller du kan lave en instance af komponenten og benytte metoderne direkte:
<?
$object = new QueryCustomer ( $param1 , $param2 , $param3 , ...);
print $object -> getHtml ();
?>
Skjul: Sådan vises komponenten
QueryCustomer, Sådan vises komponenten
Sådan vises komponenten QueryCustomer klassen
Der er ikke fundet noget
Vis: PHP source code
QueryCustomer, PHP source code
Den fulde PHP kildekode for QueryCustomer klassen
<?php /** * @package db-customer * @see HTML_DB_CUSTOMER_QUERY_PATH.'/QueryCustomer.php' * @copyright (c) http://Finn-Rasmussen.com * @license http://Finn-Rasmussen.com/license/ myPHP License conditions * @author http://Finn-Rasmussen.com * @version 1.11 * @since 27-nov-2009 */ /** * The required files */ require_once( HTML_DB_QUERY_PATH . '/Query.php' ); /** * The Query object, which will supply all the sql for the Customer * <code> * Usage: * $query = new QueryCustomer($table, $id, $sid, $translate, $orderby, $sort, * $skip, $show, $condition, $groupby, $having, $subtotal); * $sql = $query->get(); * Or * $sql = QueryCustomer::get($table, $id, $sid, $translate, $orderby, $sort, * $skip, $show, $condition, $groupby, $having, $subtotal); * </code> * @package db-customer */ class QueryCustomer extends Query { /** * Constructor * @param String $table The table to use * @param int $id The ID used in the where clause * @param String $sid The SID used in the where clause * @param boolean $translate The query is translated to language (true) * @param String $orderby The Order By to use * @param String $sorted The sorted asc/desc (together with order by) * @param String $skip The skip number of lines * @param String $show The number to show * @param String $condition The id and sid are ignored and this condition is used instead * @param String $groupby The group by * @param String $having The having (together with group by) * @param boolean $subtotal The query has a subtotal */ function __construct ( $table , $id = '' , $sid = '' , $translate = true , $orderby = '' , $sort = '' , $skip = '' , $show = '' , $condition = '' , $groupby = '' , $having = '' , $subtotal = false ) { parent :: __construct ( $table , $id , $sid , $translate , $orderby , $sort , $skip , $show , $condition , $groupby , $having , $subtotal ); } /** * Return the column array as part of the query * @return array The requested array of columns */ protected function getColumn () { return VIEW_COLUMN_CUSTOMER ; } /** * Return the SELECT part of the query * @return String The requested query */ protected function select () { return $this -> columns ( VIEW_COLUMN_CUSTOMER_NAME , VIEW_COLUMN_CUSTOMER_DEFAULT ); } /** * Return the query specified * @static * @param String $table The table to use * @param String $id The primary key to use * @param String $sid The foreign key to use * @param boolean $translate The query is translated to language (true) * @param String $orderby The Order By to use * @param String $sort The sort order asc/desc * @param String $skip The skip number of lines * @param String $show The number to show * @param String $condition The id and sid are ignored and this condition is used instead * @param String $groupby The group by * @param String $having The having (together with group by) * @param boolean $subtotal The query has a subtotal * @return String The requested query */ public static function get ( $table , $id = '' , $sid = '' , $translate = true , $orderby = '' , $sort = '' , $skip = '' , $show = '' , $condition = '' , $groupby = '' , $having = '' , $subtotal = false ) { $query = new QueryCustomer ( $table , $id , $sid , $translate , $orderby , $sort , $skip , $show , $condition , $groupby , $having , $subtotal ); return $query -> getSql (); } } ?>
Vis: HTML source code
QueryCustomer, HTML source code
Den fulde HTML kildekode for QueryCustomer klassen
<?
Der er ikke fundet noget
?>
Vis: Class methods
QueryCustomer, Class methods
Her er 'klasse metoderne' for QueryCustomer klassen:
__construct
get
setTranslate
columns
subtotal
from
where
orderby
groupby
having
limit
getClassName
getSql
getCount
Vis: Object vars
QueryCustomer, Object vars
Her er 'objekt variable' for QueryCustomer klassen:
Desværre har du ikke slået javascript til i din browser, så dele af hjemmesiden vil ikke fungere