PHP Classes

File: index.php

Recommend this page to a friend!
  Packages of adam berger   Create Table PDO   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: index
Class: Create Table PDO
Create and drop database tables using PDO
Author: By
Last change: php
Date: 12 years ago
Size: 1,222 bytes
 

 

Contents

Class file image Download
<?php
include_once basename('create-table-class-pdo.php');
/**
 * PHP 5.1
 */ 

/**
 * index.php 
 * 
 * @version 1.00
 * @license free,  Noncommercial — You may not use this work for commercial purposes. 
 * @author Adam Berger <ber34@o2.pl>
 * @Site www.joomla-cms.com.pl 
 */  


$create   = new createtableclass();

   $table="admin";
   
   $sql2 = 'CREATE TABLE IF NOT EXISTS `admin` ('
               .'`id_ad` int(11) NOT NULL AUTO_INCREMENT,'
               .'`login` varchar(255) NOT NULL,'
               .'`password` varchar(255) NOT NULL,'
               .'`sesion` varchar(255) NOT NULL,'
               .'PRIMARY KEY (`id_ad`)'
               .') ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;';
    ##################################################################################           
               
   // zapytanie
   $insert=$sql3 = "INSERT INTO `admin` (`id_ad`, `login`, `password`, `sesion`) VALUES 
          (?, ?, ?, ?)";
   // dane dla insert      
   $insert_execute = array('2', 'admin', 'admin', '0');
   
$create->drop_table($table); /* or */ $create->create_table($table, $sql2, $insert, $insert_execute);
   
  
    echo $create->error_table();