I am currently updating php code to use PDO. The legacy code is:
list($category_name,$parentid) =
mysql_fetch_row(mysql_query(sprintf(" select name, parentid_fk from category
where categoryid = '%s' ", mysql_escape($categoryid))));
I have so far updated it to:
$stmt = $db->prepare("select
name, parentid_fk
from
category
where
id = :categoryid
");
$stmt->bindParam(":categoryid",$categoryid, PDO::PARAM_INT);
$stmt->execute();
list($category_name,$parentid) = $stmt->fetch(PDO::FETCH_ASSOC);
When I echo $category_name
or echo $parentid
the values come out null. Can anyone tell me how to use the php list function with PDO?
Thanks