如何从查询数组结果集中获取值并将其故事记录在另一个变量中,这是我的尝试:
$countEps = Singlequery('SELECT COUNT(1) AS num_eps FROM items WHERE name = :name',
array('name' => $_GET['name'], ), $conn);
// Store the number of episodes
$ep = $num_eps;
这是查询返回的内容:
Array ( [0] => Array ( [num_eps] => 15 ) )
答案 0 :(得分:1)
你应该这样做
print_r($countEps);
$ep = array();
foreach($countEps as $value){
$ep = array('num_eps' => $value['num_eps'])}
print_r($ep);