1

I have a problem with this php code.

$q=$cn->exec('call get_count(1,@no_of_users)');
$res=$cn->query('select @no_of_users')->fetchAll();
echo "users".$res['@no_of_users']; 
print_r($res);

I get this output.

usersArray ( [0] => Array ( [@no_of_users] => 3 [0] => 3 ) )

Can anyone tell me how to echo value 3 only. That means I need to show the value of '@no_of_users'.

1
  • $res[0]['@no_of_users'] Commented Mar 7, 2014 at 21:11

2 Answers 2

2

You can do as

echo $res[0]["@no_of_users"];
Sign up to request clarification or add additional context in comments.

Comments

0

If $cn holds PDO instance use fetchColumn() instead of fetchAll()

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.