WebSite-PHP Framework PHP
Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
Download WebSite-PHP FrameWork now
 


Loading
 


Tutorial : Table loaded 
by a query

Tutorials

>

Tutorial Database

>

Tutorial : Table loaded by a query


Database-05: Tutorial of the composant Database of the PHP FrameWork WebSite-PHP.

Tutorial : Table loaded by a query:

favorite_page_id
name
url
actif
1
WebSite-PHP
http://www.website-php.com
1
2
Meteo Europ
http://www.meteo-europ.com
1
3
OracleRef
http://www.oracleref.com
1
4
WebSite-PHP
http://www.website-php.com
0
5
Meteo Europ
http://www.meteo-europ.com
0
7
WebSite-PHP
http://www.website-php.com
1
8
Meteo Europ
http://www.meteo-europ.com
1
9
OracleRef
http://www.oracleref.com
1


Go back to tutorial of the componant Database



Source code

Source code


File: /pages/tutorials/database/database-05.php

<?php
class Database05 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Table loaded 
                                by a query"
;
        
        
// Create table
        
$this->render = new Table();
        
$this->render->setId("user_table_5");
        
$this->render->activateAdvanceTable();
        
        
// load data from query
        
$sql = new SqlDataView(new FavoritePageDbTable());
        
$this->render->loadFromSqlDataView($sql);
    }
}
?>


Go back to tutorial of the componant Database


Tables

Tables


drop table if exists `favorite_page`;

/*==============================================================*/
/* table: `favorite_page`                                       */
/*==============================================================*/
create table `favorite_page`
(
   favorite_page_id  int not null  auto_increment,
   name              varchar(20),
   url               varchar(255),
   actif             boolean,
   primary key (favorite_page_id)
) engine = innodb;

insert into `favorite_page` (name, url, actif) 
    values('WebSite-PHP', 'http://www.website-php.com', true);
insert into `favorite_page` (name, url, actif) 
    values('Meteo Europ', 'http://www.meteo-europ.com', true);
insert into `favorite_page` (name, url, actif) 
    values('OracleRef', 'http://www.oracleref.com', true);
insert into `favorite_page` (name, url, actif) 
    values('WebSite-PHP', 'http://www.website-php.com', false);
insert into `favorite_page` (name, url, actif) 
    values('Meteo Europ', 'http://www.meteo-europ.com', false);
insert into `favorite_page` (name, url, actif) 
    values('OracleRef', 'http://www.oracleref.com', false);


Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker