PHP Classes

File: demos/DemoConnectionDataAccess.php

Recommend this page to a friend!
  Classes of Rene Gonzalez   PHP HTML Components   demos/DemoConnectionDataAccess.php   Download  
File: demos/DemoConnectionDataAccess.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP HTML Components
Generate HTML elements linked to database data
Author: By
Last change:
Date: 5 years ago
Size: 1,290 bytes
 

Contents

Class file image Download
<?php

require_once '../Connection.php';
require_once
'../DataAccess.php';

#Open connection
#Create instance of Connection
$conn = new Connection('localhost','test','root','');
#Create simple connection
$link = $conn->SimpleConnectionPDO();

var_dump($link);

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

#Execute query
#Create instance of DataAccess
$exec = new DataAccess();

#Pass parameter Connection
$exec->SetConn($link['obj_']);

#CRUD Create, Read, Update, Delete
#======================================================================================================

$exec->setParams(array(":val1"=>"iPhone|string",":val2"=>"Smarthphone|string",":val3"=>"255|int"));
$exec->setQuerycmd("Insert");
$exec->setQuerycrud("INSERT INTO pruebas (val1,val2, val3) VALUES(:val1, :val2, :val3);");

$dats = $exec->ExecuteCommand();
var_dump($dats);

#======================================================================================================
/*
$exec->setQuerycmd("Read");
$exec->setQuerycrud("SELECT id, val1,val2, val3 FROM pruebas;");

$dats = $exec->ExecuteCommand();
var_dump($dats);
*/
#======================================================================================================