PHP Classes

File: examples/1-create_table.php

Recommend this page to a friend!
  Classes of MarPlo   PDO_MySQLi class   examples/1-create_table.php   Download  
File: examples/1-create_table.php
Role: Example script
Content type: text/plain
Description: Example 1
Class: PDO_MySQLi class
Access MySQL using PDO or MySQLi extensions
Author: By
Last change:
Date: 10 years ago
Size: 695 bytes


Class file image Download
// includes the file that contains data for connecting to mysql database, and PDO_MySQLi class

// creates object with connection to MySQL
$conn = new PDO_MySQLi($mysql);

$sql = "CREATE TABLE `testclass` (`id` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, `url` VARCHAR(255), `title` VARCHAR(125), `dt` INT(11) NOT NULL) CHARACTER SET utf8 COLLATE utf8_general_ci";

// executes the SQL query, passing only the string with SQL query
$resql = $conn->sqlExecute($sql);

// check if the SQL query succesfully performed, else, outputs error message
if($resql) echo 'The table "testclass" succesfully created.';
else echo