db connection

<?php try { $pdo = new PDO('mysql:host=localhost;dbname=ijdb', 'root', 'root'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMOD_EXCEPTION); $pdo->exec('SET NAMES "utf8"'); } catch (Exception $e) { $error = 'Unable to connect to the database server.'; include 'error.html.php'; exit(); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.