jcadima
5/16/2015 - 8:31 PM

Code that returns a result set that contains one row

Code that returns a result set that contains one row

<?php

    $query = 'SELECT * FROM categories
              WHERE categoryID = :category_id';    
    $statement = $db->prepare($query);
    $statement->bindValue(':category_id', $category_id);
    $statement->execute();    
    $category = $statement->fetch();
    $statement->closeCursor();