Here is my code:
$q = $db->prepare("SELECT * from slider WHERE page = :page ORDER BY index ASC");
$q->bindValue(':page', basename($_SERVER['PHP_SELF']));
$q->execute();
if ($q->rowCount() > 0){
$result = $q->fetchAll(PDO::FETCH_ASSOC);
for ($i=0; $i < $q->rowCount(); $i++) {
$path = $result[$i]['path'];
echo "<div><img src=\"$path\"></div>";
}
}
As is, there is no result that is being shown. If however I order by a different field, namely 'id' which is auto increment and the primary key of the table, I do get results that are ordered by the correct field.