WebSite-PHP Framework PHP
Mehrsprachig
Einfacher Ajax Modus
Kein HTML, kein JavaScript
URL Rewriting
Mails senden
Sitemap - RSS - Web service
Laden Sie WebSite-PHP FrameWork jetzt herunter
 


Loading
 


Tutorial : Select query

Tutorials

>

Tutorial Database

>

Tutorial : Select query


Database-04: Tutorial der Komponente Database vom PHP FrameWork WebSite-PHP.

Tutorial : Select query:

product_id name price
1 Coca 0.5 €
2 Hamburger 5.2 €
3 Water 0.8 €
4 Milk 1 €



Zurück zum Tutorial der Komponente Database



Quelltext

Quelltext


Datei: /pages/tutorials/database/database-04.php

<?php
class Database04 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Select query";
        
        
// init result table
        
$this->render = new Table();
        
$this->render->setTitle(
        new 
Label(ucfirst(ProductDbTable::TABLE_NAME)." :"true));
        
$this->render->setId("product_table_2");
        
$this->render->addRowColumns(
                    
ProductDbTable::FIELD_PRODUCT_ID,
                    
ProductDbTable::FIELD_NAME,
                    
ProductDbTable::FIELD_PRICE)
                    ->
setHeaderClass(0);
        
        
// execite select query
        
$sql = new SqlDataView(new ProductDbTable());
        
$sql->setLimit(0100);
        
$sql->setClause(ProductDbTable::FIELD_PRICE." > 0");
        
$it $sql->retrieve();
        while (
$it->hasNext()) {
            
$row $it->next();
            
$this->render->addRowColumns(
                
$row->getValue(ProductDbTable::FIELD_PRODUCT_ID), 
                
$row->getValue(ProductDbTable::FIELD_NAME), 
                
$row->getValue(ProductDbTable::FIELD_PRICE).
                                                
" &euro;");
        }
        
$this->render->activateAdvanceTable();
        
        
$this->render = new WSPObject($this->render"<br/>");
    }
}
?>


Zurück zum Tutorial der Komponente Database


Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Start Dokumentation Herunterladen Schnellstart Tutorials Wiki Issue Tracker