Introduction PHP PDO Connecting to SQL: 1. new PDO("sqlsrv:Server=$servername; Database=$dbname",$username,$password); Connecting to Oracle: 1. new PDO("OCI:dbname=accounts;charset=UTF-8","username","password"); Connecting to PgSQL: 1. $db = new PDO("pgsql:dbname=pdo;host=localhost","username", "password"); Connecting to MySQL: 1. $db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password'); 2. $db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password', array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); 3. $db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::E...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.