Exercício PHP/PDO | Connect.php

<?php try { $connect = new PDO("mysql:host=localhost; dbname=my_db; charset=utf8", 'root', ''); } // No PHP 7 devo apenas substituir a classe PDOException por Throwable? catch (PDOException $e) { // Interrompe a execução do script e exibe a mensagem de erro die("ERRO: " . $e->getMessage() . "<br>LINHA: " . $e->getLine()); } echo "Conectado com sucesso ao banco de dados!";

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.