Connecting to Database

The same as any other data-driven component List can load and save data by means of connectors.

Client-side init

//index.html
var myList = new dhtmlXList("someContainer"); // initializes List
...
myList.load("php/data.php");
var myDP = new dataProcessor("php/data.php"); // initializes dhtmlxDataProcessor
myDP.init(myList);

Server-side init

<?php
    require_once("../../../connector/dataview_connector.php");
 
    $conn = new PDO("mysql:dbname=dataview;host=localhost","root","");
 
    $data = new DataViewConnector($conn);
    //table name, ID, list of properties
    $data->render_table("packages_small","Id","Package,Version,Maintainer");
?>

Related sample:  Connecting to database

Back to top