PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of José Augusto Ferreira Franco   MySQL2Conndbs   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: some short tests using this class
Class: MySQL2Conndbs
MySQL database access wrapper
Author: By
Last change: adapt the example to class changes
Date: 16 years ago
Size: 2,459 bytes
 

Contents

Class file image Download
<?php

 
require "mysql_conn.class.php";
 
define("__HOST","localhost"); // constantes com as configurações do servidor
define("__USER","root"); # defining host settings constantes
define("__PASS","");



 
// pt :: instanciar classe mysql_conn generalizada
   # en :: intanciates generalized class

$Conn = new MySQL_Conn();

// passando os valores da configuração à classe
# pass the config values to class
   
$Conn->host = __HOST;
   
$Conn->user = __USER;
   
$Conn->pwd = __PASS;

  
// pt :: abrir a ligação com o servidor ( a variavel link armazena o recurso de ligação parac usar em pedidos futuros)
   # en :: opens server connection (variable $link stores the resource connection to use in future requestes)
   
$link = $Conn->open_conn();


  
 
//pt :: cria a base de dados indicada no parâmetro
  # en :: creates database name seted by parameter
 
$Conn->create_db("yourDatabase");
 
 
// pt :: selecciona a base de dados indicada no parâmetro
  # en :: selects database seted on parameter
 
$Conn->select_db("yourDatabase");
 
 
// pt :: contruição do array que permite criar a tabela e os campos da mesma
  # en :: building the array process to generate table and respective fields

 
               
       
       
$table = array("TABLE" => "youTable", //(nome da table) table name
                        
"id" => "INTEGER AUTO_INCREMENT PRIMARY KEY", // (campos da tabela e tipo de dados) table fields and data type
                        
"videoID" => "VARCHAR(40)",
                        
"name" => "VARCHAR(200)",
                        
"comments" => "VARCHAR(600)",
                        
"rate" => "VARCHAR(20)");


   
 
// pt :: cria a tabela e os campos indicados no array acima
  # en :: creates table and fields seted on array below
   
$Conn->create_table($table);
 
 
$date = date("y.m.d");

 
$info= array("",
                
"Class MySQL Conn ",
                
"This class allows an easy connection with mysql layer to database access",
                
"Guto Ferreira",
                 
"".$date."");
  
                
$Conn->Insert($table,$info)

 


/************************************************************************************

this classe is currently for update at http://ww.revista-php.net (downloads section)
for more free components visit us or email at guto.onidesk@gmail.com
*************************************************************************************/
?>