Location: PHPKode > scripts > MySQL_data_table > mysql_data_table/mysql_data_table.class.php
<?php
/*
    Class: mysql_data_table
    Author: Sven Zurnieden
    Email: hide@address.com
    
    Description:
        This class is extending data_table class which generates a html-table from a dataset array.
        For info on datatable look in data_table.class.php.
        Just set the query and execute it.
        Use then the methods of data_table class to change layout from table.
        
    HAVE FUN NOW, hope this class is useful
*/

require_once("data_table.class.php");

class mysql_data_table extends data_table{
    
    var $query      = false;    //the query
    
    function set_query($query){
        //sets the query
        $this->query = $query;
    }
    
    function execute_query($db_host, $db_user, $db_pass, $db){
        //executes the query
        $connect = mysql_connect($db_host, $db_user, $db_pass);
        mysql_select_db($db);
        $query = mysql_query($this->query, $connect);
        $i = 0;
        while($result = mysql_fetch_array($query, MYSQL_ASSOC)){
            $data[$i] = $result;
            $i++;
        }
        $this->set_data($data);
    }
}
?>
Return current item: MySQL_data_table