This post is in process. It will discuss and demonstrate the difference between using bindParam() which sets a placeholder by reference and bindValue which sets by value.
This PHP script is for creating a PDO connection object
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?php // d e m o F u n c t i o n s . p h p /* This function demos how to create a PDO mysql db connection object */ function connectToMySQL($hostIn, $dbIn, $userIn, $passwordIn) { try { $MySQLDataBaseLink = new PDO( "mysql:host=" . $hostIn . ";dbname=" . $dbIn, $userIn, $passwordIn); $MySQLDataBaseLink->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $MySQLDataBaseLink; } catch(PDOException $e) { echo '<h3><br />Catch Connect Error--->>> ' . $e->getMessage() . '<br /></h3>'; return false; } //End Try Catch } // End connectToMySQL() function |
