PHP Classes

File: examples/mysql/createsequence.php

Recommend this page to a friend!
  Classes of Jorge Castro   PHP PDO One   examples/mysql/createsequence.php   Download  
File: examples/mysql/createsequence.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP PDO One
Access to database with PDO and run common queries
Author: By
Last change:
Date: 19 days ago
Size: 958 bytes
 

Contents

Class file image Download
<?php /** @noinspection SqlNoDataSourceInspection */

use eftec\PdoOne;
use
mapache_commons\Collection;


include
"../../vendor/autoload.php";
include
"../Collection.php";
include
"../dBug.php";
echo
"<body><div style='width:600px'>";
// connecting to database sakila at 127.0.0.1 with user root and password abc.123
$dao=new PdoOne("mysql","127.0.0.1","root","abc.123","sakila","");
$dao->logLevel=3;
try {
    echo
"<h1>Connection. The instance {$dao->server}, base:{$dao->db} user:{$dao->user} and password:{$dao->pwd} must exists</h1>";
   
$dao->connect();
    echo
"Connected A-OK!<br>";
} catch (
Exception $e) {
    echo
"<h2>connection error:</h2>";
    echo
$dao->lastError()."-".$e->getMessage()."<br>";
    die(
1);
}

if(
$dao->tableExist('mysec_table')) {
   
$dao->dropTable('mysec_table');
}
if(
$dao->objectExist('next_mysec_table','function')) {
   
$dao->drop('next_mysec_table','function');
}

$dao->createSequence('mysec_table','sequence');