<?php
require_once( HTML_DB_SELECT_QUERY_PATH . '/QuerySelect.php' );
$sql = QuerySelect :: get ( 'demo_select' );
?>
<? // Which now contains the following SQL:
$sql = SELECT ` demo_select_id `,
demo_select .` demo_session_id `,
demo_select .` name ` as ` name `,
demo_select .` label ` as ` label `,
demo_select .` value ` as ` value `,
demo_select .` text ` as ` Tekst `,
demo_select .` selected ` as ` selected `,
demo_select .` created_date ` as ` Dato for oprettelse `,
demo_select .` modified_date ` as ` Ændret ` FROM ` demo_select ` WHERE
demo_select .` demo_session_id `= '5cb3a39002cf9566f2ba763dbce8ef96' LIMIT 400
?>
Tilbage
Skjul: Navn
QuerySelect.php
Vis: Sample code, tutorial
QuerySelect, Sample code, tutorial
Sådan benyttes komponenten QuerySelect klassen
Først skal du inkludere den fil der beskriver komponenten, som en klasse fil
<?
require_once( HTML_PACKAGE_PATH . '/QuerySelect.php' );
?>
Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):
<?
QuerySelect :: display ( $param1 , $param2 , $param3 , ...);
?>
eller du kan lave en instance af komponenten og benytte metoderne direkte:
<?
$object = new QuerySelect ( $param1 , $param2 , $param3 , ...);
print $object -> getHtml ();
?>
Skjul: Sådan vises komponenten
QuerySelect, Sådan vises komponenten
Sådan vises komponenten QuerySelect klassen
Der er ikke fundet noget
Vis: PHP source code
QuerySelect, PHP source code
Den fulde PHP kildekode for QuerySelect klassen
<?php /** * @package db-select * @see HTML_DB_SELECT_QUERY_PATH.'/QuerySelect.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' ); if ( defined ( 'HTML_LANGUAGE_UTIL_PATH' )) { require_once( HTML_LANGUAGE_UTIL_PATH . '/Translate.php' ); } /** * The Query object, which will supply all the sql for the Links * <code> * Usage: * $query = new QuerySelect($table, $id, $sid, $translate, $orderby, $sort, * $skip, $show, $condition, $groupby, $having, $subtotal); * print $query->getSql(); * Or * $query = QuerySelect::get($table, $id, $sid, $translate, $orderby, $sort, * $skip, $show, $condition, $groupby, $having, $subtotal); * </code> * @package db-basket */ class QuerySelect 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 ) { $theOrderby = $orderby != '' ? $orderby : SELECT_OPTGROUP_LABEL ; $theSort = $sort != '' ? $sort : SORT_BY_ASC ; $theCondition = $condition != '' ? $condition : "" ; parent :: __construct ( $table , $id , $sid , $translate , $theOrderby , $theSort , $skip , $show , $theCondition , $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_SELECT ; } /** * Return the SELECT part of the query * @global String DEFINE_SELECT_LINK The Select Table for the Links * @return String The requested query */ protected function select () { return $this -> columns ( VIEW_COLUMN_OPTION_REQUEST_NAME , VIEW_COLUMN_OPTION_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 QuerySelect ( $table , $id , $sid , $translate , $orderby , $sort , $skip , $show , $condition , $groupby , $having , $subtotal ); return $query -> getSql (); } } ?>
Vis: HTML source code
QuerySelect, HTML source code
Den fulde HTML kildekode for QuerySelect klassen
<?
Der er ikke fundet noget
?>
Vis: Class methods
QuerySelect, Class methods
Her er 'klasse metoderne' for QuerySelect klassen:
__construct
get
setTranslate
columns
subtotal
from
where
orderby
groupby
having
limit
getClassName
getSql
getCount
Vis: Object vars
QuerySelect, Object vars
Her er 'objekt variable' for QuerySelect klassen:
Desværre har du ikke slået javascript til i din browser, så dele af hjemmesiden vil ikke fungere