<?php
require_once( HTML_DB_BASKET_QUERY_PATH . '/QueryBasket.php' );
$sql = QueryBasket :: get ( 'demo_basket' );
?>
<? // Which now contains the following SQL:
$sql = SELECT ` demo_basket_id `,
demo_basket .` demo_session_id `,
demo_basket .` href ` as ` Link `,
demo_basket .` text ` as ` Tekst `,
demo_basket .` description ` as ` Beskrivelse `,
demo_basket .` quantity ` as ` Antal `,
demo_basket .` price ` as ` Pris `,
(` quantity `*` price `) AS ` Beløb ` FROM ` demo_basket ` WHERE
demo_basket .` demo_session_id `= '5cb3a39002cf9566f2ba763dbce8ef96' LIMIT 400
?>
Tilbage
Skjul: Navn
QueryBasket.php
Vis: Sample code, tutorial
QueryBasket, Sample code, tutorial
Sådan benyttes komponenten QueryBasket klassen
Først skal du inkludere den fil der beskriver komponenten, som en klasse fil
<?
require_once( HTML_PACKAGE_PATH . '/QueryBasket.php' );
?>
Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):
<?
QueryBasket :: display ( $param1 , $param2 , $param3 , ...);
?>
eller du kan lave en instance af komponenten og benytte metoderne direkte:
<?
$object = new QueryBasket ( $param1 , $param2 , $param3 , ...);
print $object -> getHtml ();
?>
Skjul: Sådan vises komponenten
QueryBasket, Sådan vises komponenten
Sådan vises komponenten QueryBasket klassen
Der er ikke fundet noget
Vis: PHP source code
QueryBasket, PHP source code
Den fulde PHP kildekode for QueryBasket klassen
<?php /** * @package db-basket * @see HTML_DB_BASKET_QUERY_PATH.'/QueryBasket.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 Basket * <code> * Usage: * $query = new QueryBasket($table, $id, $sid, $translate, $orderby, $sort, * $skip, $show, $condition, $groupby, $having, $subtotal); * print $query->getSql(); * Or * $query = QueryBasket::get($table, $id, $sid, $translate, $orderby, $sort, * $skip, $show, $condition, $groupby, $having, $subtotal); * </code> * @package db-basket */ class QueryBasket 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 = true ) { 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_BASKET ; } /** * Return the SELECT part of the query * @return String The requested query */ protected function select () { return $this -> columns ( VIEW_COLUMN_BASKET_NAME , VIEW_COLUMN_BASKET_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 = true ) { $query = new QueryBasket ( $table , $id , $sid , $translate , $orderby , $sort , $skip , $show , $condition , $groupby , $having , $subtotal ); return $query -> getSql (); } } ?>
Vis: HTML source code
QueryBasket, HTML source code
Den fulde HTML kildekode for QueryBasket klassen
<?
Der er ikke fundet noget
?>
Vis: Class methods
QueryBasket, Class methods
Her er 'klasse metoderne' for QueryBasket klassen:
__construct
get
setTranslate
columns
subtotal
from
where
orderby
groupby
having
limit
getClassName
getSql
getCount
Vis: Object vars
QueryBasket, Object vars
Her er 'objekt variable' for QueryBasket klassen:
Desværre har du ikke slået javascript til i din browser, så dele af hjemmesiden vil ikke fungere