PHP Classes

File: example/recordset.php

Recommend this page to a friend!
  Classes of Everton da Rosa  >  PTK Validation  >  example/recordset.php  >  Download  
File: example/recordset.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PTK Validation
Validate values of dates, files and directories
Author: By
Last change:
Date: 8 years ago
Size: 1,232 bytes
 

Contents

Class file image Download
<?php

/*
 * Copyright (C) 2014 Everton
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */


/**
 * This file is a simple example of Recordset class.
 */

try{
    require
'examples.inc.php';
   
   
$pdo = new PDO('sqlite:./example.db');//connect to db
   
echo "Success to connect at database.".PHP_EOL;
   
$rs = new \Ptk\db\Recordset($pdo, 'peoples');//create recordset and load
   
   
echo "Recordset has {$rs->rowCount()} rows now.".PHP_EOL;
   
    echo
"The current row from record set content field name: {$rs->name}.".PHP_EOL;
   
} catch (
Exception $ex) {
    echo
$ex->getMessage();
    exit(
$ex->getCode());
}