The foreach won’t echo anything out, anybody knows what’s wrong with it?
Note: $checks is the value of checkboxes.
<?php
$hostname = 'localhost';
$username = 'root';
$password = '';
$database = 'foo';
try{
$db = new PDO("mysql:host=$hostname;dbname=$database",$username,$password);
$checks = $_POST['checks'];
$post = "SELECT * FROM articles WHERE title= ' ". $checks ." '";
foreach($db->query($post) as $row){
echo $row['title'] . '' . $row['body'];
}
}catch(PDOException $e){
echo 'CONNECTION UNSUCCESFUL!';
}
?>
Extra spacing around the title? So the title with the extra spaces around it never gets a match from the your database.
Change to
and try again.