fear my google-fu
$pdo = new PDO(
'mysql:host=mysql.example.com;dbname=example_db',
"username",
"password",
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
first hit 😉
More Related Contents:
- How do detect that transaction has already been started?
- php, mysql – Too many connections to database error
- avoiding MySQL injections with the Zend_Db class
- Can I mix MySQL APIs in PHP?
- Can PHP PDO Statements accept the table or column name as parameter?
- Can I bind an array to an IN() condition in a PDO query?
- PDOException “could not find driver”
- Row count with PDO
- PDO get the last ID inserted
- How to view query error in PDO PHP
- PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers
- Insert/update helper function using PDO
- PHP PDO – Bind table name? [duplicate]
- Is the leading colon for parameter names passed to PDOStatement::bindParam() optional?
- How to debug PDO database queries?
- PDO’s query vs execute
- Resetting array pointer in PDO results
- Parametrized PDO query and `LIMIT` clause – not working [duplicate]
- Using htmlspecialchars function with PDO prepare and execute
- Do SQL connections opened with PDO in PHP have to be closed
- Alternative for mysql_num_rows using PDO
- Unknown database error in PHP but it exists in PHPMyAdmin
- return one value from database with mysql php pdo
- return multiple response data in one response
- Running a Zend Framework action from command line
- PDO lastInsertId() always return 0
- Do PHP PDO prepared statements need to be escaped?
- How can I pass an array of PDO parameters yet still specify their types?
- session_start() takes VERY LONG TIME
- PDO and MySQL ‘between’