PHP Classes

File: example_get_table_with_limit.php

Recommend this page to a friend!
  Packages of Rafal Antczak   RA PHP MySQL CRUD class   example_get_table_with_limit.php   Download  
File: example_get_table_with_limit.php
Role: Example script
Content type: text/plain
Description: Example script
Class: RA PHP MySQL CRUD class
Manipulate data in MySQL database tables
Author: By
Last change:
Date: 7 years ago
Size: 748 bytes
 

 

Contents

Class file image Download
<?php
/*
 *  Example - get records from table with limit of records
 */


// Include Table class

    require_once 'class.table.php';

    
/*
 *  Init new Table object with database parameters specified in db_params.php
 *  In this example the name of your table is 'table1'
 */
    
    $some_table = new Table('table1');
    

/*
 *  Set limit of records = 2
 */    
    
    $some_table -> limit = 2;
    
    
    $my_data = $some_table ->getTableWithLimit();
    
/*
 *  If you need data in ascending or descending order you may use
 *  getTableWithLimitAsc()
 *  or
 *  getTableWithLimitDesc()
 */    
    
    
    if ($my_data !== FALSE) {
        
        var_dump($my_data);
        
    }


?>