2012年07月05日 PHP:さくらインターネットでDB使う時のメモ PHPの検証用にさくらインターネットのレンタルサーバを借りているのですが、DB使うところでやり方忘れて少しだけ躓いたので忘れないようにメモ。 まずサーバコントロールパネルでDBの情報を確認。 赤丸の部分を使ってPHP上でアクセスします。 (下記の値は架空のものです。) $param = 'mysql:dbname=username_test;host=******.db.sakura.ne.jp'; $user = 'username'; $pass = 'password'; $pdo = new PDO($param, $user, $pass); $pdo->query('SET NAMES utf8;'); // これをしないと文字化けする $sql = "INSERT INTO test_datas(body