PHPで作るページング機能 ドットインストール

おまじない的なやつの意味を理解したい

 

mysql -u root  まずはrootで入る

create database dotinstall_paging_php;

grant all on dotinstall_paging_php.* to dbuser@localhost identified by "";

use dotinstall_paging_php

 

DB周りを定数におく

define('DB_HOST', 'localhost');
define('DB_USER', 'dbuser');
define('DB_PASSWORD', '');
define('DB_NAME', 'dotinstall_paging_php');

エラー設定  決まり文句的な

error_reporting(E_ALL & ~E_NOTICE);

try{
    $dbh = new PDO('mysql:host=' . DB_NAME, DB_USER, DB_PASSWORD);
}catch(PDOException $e){
  echo $e->getMessage();
  exit;
}