Location: PHPKode > scripts > DB Layer > db-layer/example.php
<?php
//Example 1 : simple operation with mysql
//include('mylayer.class.php');
//$dblayer = new mylayer;
//$dblayer -> params("host","user","pass","db");
//$dblayer -> connect();
//$dblayer -> query_exec("select * from table");
//while ( $valore = $dblayer -> rs_array()){

//echo $valore['name_field']."<br>";

//}

//Example 1 bis : simple operation with postgres
//include('pglayer.class.php');
//$dblayer = new pglayer;
//$dblayer -> params("host","user","pass","db");
//$dblayer -> connect();
//$dblayer -> query_exec("select * from table");
//while ( $valore = $dblayer -> rs_array()){

//echo $valore['name_field']."<br>";

//}


 /*
//Example 2: query with pagination
//include('mylayer.class.php');
//$dblayer = new mylayer;
//$dblayer -> params("host","user","pass","db");
//$dblayer -> connect();
//$dblayer -> query_exec_pg("select * from table");
//while ( $valore = $dblayer -> rs_array()){

//echo $valore['name_field']."<br>";

//}

//echo $dblayer -> current_page();  //number of current page
//echo $dblayer -> number_page();  //total pages
//echo $dblayer -> qstring("var=34&prv=56");
//echo $dblayer -> next_page("next"); //href per navigare tra i risultati
//echo $dblayer -> previous_page("pre");  //href per navigare tra i risultati
//echo $dblayer -> all_page();  //all page number

other features
//echo $dblayer -> next_page("<img src=\"freebsd.gif\" border=\"0\">");  //utilizzare un immagine invece del collegamento testuale
//echo $dblayer -> num_rows(); //rows number

?>
Return current item: DB Layer