PHP Classes

File: Example.InsertAndGetID.Simple.php

Recommend this page to a friend!
  Classes of Dustin Ruckman   DB Access using PDO   Example.InsertAndGetID.Simple.php   Download  
File: Example.InsertAndGetID.Simple.php
Role: Example script
Content type: text/plain
Description: Use the simple nonQuery method to do an insert and get the Inserted ID
Class: DB Access using PDO
Query MySQL tables with prepared queries using PDO
Author: By
Last change:
Date: 9 years ago
Size: 289 bytes
 

Contents

Class file image Download
<?php

require('path/to/DatabaseAccess.Class.php');

$DbAccess = new DatabaseAccess("yourHost", "dbName", "dbUser", "dbUserPassword");

$numberOfRowsUpdated = $DbAccess->SimpleNon("INSERT INTO `UserAccounts` (`FirstName`) VALUES ('')");
$IdOfRowInserted = $DbAccess->LastInsertID();