I got this example from the php site:
<?php
try {
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
foreach($dbh->query('SELECT * from FOO') as $row) {
print_r($row);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
I use MAMP on the mac, and when I call my local site it looks like this:
http://localhost:80/mysite/index.php
so what exactly would I have to write in
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
for host= ? would that be localhost, or would that be localhost:80? or something totally different? My MySQL DB has the port number 3306. Is that relevant? Or is just "localhost" perfectly fine?