I understand that mysql_* is in the process of being removed from future PHP versions, probably not for some time, but I want to migrate my site.
I'm currently relying on the mysql functions to communicate with my database.
I want to create a set of functions dedicated to the PDO interface (PDO Interface Manual)
I just have no ideas on where to start, and if my plan will actually work.
Examples:
<?php
function PDOFetch($Var)
{
$sth = $dbh->prepare("$Var");
$sth->execute();
$result = $sth->fetchAll();
return $result;
}
function PDONumb ($Var)
{
$Query = $dbh->prepare("{$Var}");
$Execute->execute();
$count = $Execute->rowCount();
return $count;
}
?>
if I have a row of constant connections to the functions For example:
<?php
include "PHP/PDOFunctions.php";
$UserArray = PDOFetch("SELECT * FROM users WHERE username='$username'");
$Password = $UserArray['Password'];
$UniqueID = $UserArray['UID'];
$ContactInfo = PDOFetch("SELECT * FROM ContactInformation WHERE UID='{$UniqueID}'");
?>
Would the above solution be a time effective and reliable solution to put in place on my webserver?
I understand there may be errors with the code, but i'm completely new to the PDO API and want a nice script to handle my entire queries
Thanks in Advance
Daryl Gill