0

How can I take the value from the query array result set and story it in another variable this was my attempt:

$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;

This is what the query returns:

Array ( [0] => Array ( [num_eps] => 15 ) )
1
  • 2
    $countEps[0]['num_eps'] Commented Mar 4, 2015 at 14:47

1 Answer 1

1

you Should do like this

print_r($countEps);
$ep = array();
foreach($countEps as $value){
$ep = array('num_eps' => $value['num_eps'])}
print_r($ep);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.