PHP Classes

File: test/stored_procedure_test_simple_pdo.php

Recommend this page to a friend!
  Classes of Hernádi Tamás   Rasher PHP Data Access Layer Helper - Database Repository   test/stored_procedure_test_simple_pdo.php   Download  
File: test/stored_procedure_test_simple_pdo.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Rasher PHP Data Access Layer Helper - Database Repository
Run queries to access data in any type of database
Author: By
Last change:
Date: 1 year ago
Size: 455 bytes
 

Contents

Class file image Download
<?php
namespace Test;
use
PDO;

$pdo = new PDO("sqlsrv:server=(local);Database=test", "", "");
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sql = "exec getUser :Id, :LoginName";
$stmt = $pdo->prepare($sql);

$id = null;
$loginName = "user_3";
$stmt->bindParam(":Id", $id, PDO::PARAM_INT);
$stmt->bindParam(":LoginName", $loginName, PDO::PARAM_STR);
$stmt->execute();

$result = $stmt->fetchAll(PDO::FETCH_ASSOC);

var_dump($result);
?>