Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6629941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:19:59+00:00 2026-05-25T22:19:59+00:00

: Call to a member function rowCount() on a non-object in C:\wamp\www\prjy\classes\user.php on line

  • 0
: Call to a member function rowCount() on a non-object in C:\wamp\www\prjy\classes\user.php on line 34

Line 29-32

$this->sth = $this->dbh->prepare("SELECT id, userlevel FROM users WHERE username = ? AND password = ?");
$this->sth->bindParam(1, $username);
$this->sth->bindParam(2, $password);
$this->data = $this->sth->execute();

Line 34

if ($this->data->rowCount() > 0)

I want to save the result object in another variable, so I can execute another query and depending on the result, I return what is correct… Can’t I save the result, (execute()) in a variable like above? How do I solve it else way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:19:59+00:00Added an answer on May 25, 2026 at 10:19 pm

    PDOStatement::rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object.

    For most databases, PDOStatement::rowCount() does not return the number of rows affected
    by a SELECT statement. Instead,
    use PDO::query() to issue a SELECT COUNT(*) statement with the same predicates as your intended SELECT statement,
    then use PDOStatement::fetchColumn() to retrieve the number of rows that will be returned.

    Reference

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Error: Fatal error: Call to a member function bind_param() on a non-object in /var/www/web55/web/pdftest/events.php
I'm getting a Call to a member function process_data() on a non-object in page.class.php
Fatal error: Call to a member function query() on a non-object on line: $result
When i get this error: Call to a member function query() on a non-object
I'm getting a fatal Call to a member function on a non-object error in
Fatal error: Call to a member function prepare() on a non-object Is what I
I'm getting: Fatal error: Call to a member function setAccessToken() on a non-object in
I'm getting: Fatal error: Call to a member function query() on a non-object in
What's the best way to call a member function if you have an object
This code get an error : Fatal error: Call to a member function prepare()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.