Here is my code:
function connect() {
$pdo = new PDO("mysql:host=localhost;dbname=www","user","pass");
$xmax = "SELECT MAX(x) FROM headerfooter WHERE site = 'Brighter_Vista'";
$xresult = $pdo->query($xmax);
while($row = $xresult->fetch(PDO::FETCH_ASSOC)) {
print_r($row);
}
$ymax = "SELECT MAX(y) FROM headerfooter WHERE site = 'Brighter_Vista'";
$yresult = $pdo->query($ymax);
while($row = $yresult->fetch(PDO::FETCH_ASSOC)) {
print_r($row);
}
}
I call the function and nothing shows up.
I checked the query in mysql terminal and it does work.
I am new to PDO, what am I doing wrong?