Jump to content

Count of an Array


Mufleeh

Recommended Posts

Hi,

 

I need the count of the retrieved results from my data base. Below coding isn't working can anyone fix this to me?

 


$queryMe = $this->dbh->prepare("SELECT name_initials FROM view_teachers_information WHERE nic IN (SELECT nic FROM view_teachers_current_school_appointment WHERE appointment_category_name = 'Mathematics' AND census_id IN (SELECT census_id FROM view_schools WHERE division_id = '$div[division_id]'))");

				$queryMe->execute();
				$countMe = $queryMe->fetchall();

				$result = count($countMe);
				echo $result;


 

 

Regards,

Mufleeh

Link to comment
Share on other sites

Did you call it for PDO or PDOStatement ?

 

Hi,

 

I am sorry, I can not exactly understand what do you mean. I receive the above thing when I used ->errorInfo() in my coding.

 

This is how I used it.

 

print_r($this->dbh->errorInfo());

 

 

Regards,

Mufleeh

Link to comment
Share on other sites

Did you call it through PDO (accessed using $this->dbh in your code), or through PDOStatement (accessed using $statement in your code)? Both have a method called errorInfo(), but since you're using a statement I believe the error will only be available in the statement object.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.