substituir pelo nome de utilizador $password="xxxxxxxx"; // -> substituir pela password dada pelo mysql_reset $dbname = $user; // a BD tem nome identico ao utilizador $connection = new PDO("mysql:host=" . $host. ";dbname=" . $dbname, $user, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING)); echo("

Connected to MySQL database $dbname on $host as user $user

\n"); $sql = "SELECT * FROM account;"; echo("

Query: " . $sql . "

\n"); $result = $connection->query($sql); $num = $result->rowCount(); echo("

$num records retrieved:

\n"); echo("\n"); echo("\n"); foreach($result as $row) { echo("\n"); } echo("
account_numberbranch_namebalance
"); echo($row["account_number"]); echo(""); echo($row["branch_name"]); echo(""); echo($row["balance"]); echo("
\n"); $connection = null; echo("

Connection closed.

\n"); echo("

Test completed successfully.

\n"); ?>