>> 
>> 
> When you know there is only one row to be returned you can do this:
> 
> $photo_category_list = "";
>   $SQL = "SELECT category_id, category_name FROM gallery_category ORDER by 
> category_order";
>   try {
>       $stmt = $dbh->prepare($SQL);
>       $stmt->execute();
>       list( $id, $name) = $stmt->fetch(PDO::FETCH_NUM));
>      }
>   }
>   catch (PDOException $e){
>       echo 'Error getting category name. ' . $e->getMessage();
>   }
> 
> echo $id;
> echo $name;
> 
> And you could also do
> 
>       list( $result["id"], $result["name"]) = $stmt->fetch(PDO::FETCH_NUM));
> 
> 
> -- 
> Stephen
> 

Thanks very much for your help Stephen - I will try this asap!




--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]

Reply via email to