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 7832273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:07:54+00:00 2026-06-02T12:07:54+00:00

Hi i need to do a simple query but something is wrong. I have

  • 0

Hi i need to do a simple query but something is wrong. I have $name and $surname and i need to search the (possible multiple) id that rappresent that name and surname and put all the id, name and surname in a array
I do this query:

$result=$this->_db_table->select()->where('name=?',$name)
    ->where('surname=?', $surname)->query()
    ->fetchAll();

$array=$result->toArray();
return $array;

If i use

$result=$this->_db_table->fetchAll();
$array=$result->toArray();
return $array

it work correctly and i have an array whith all the value in the database in that table. What is wrong in my first code???

  • 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-06-02T12:08:00+00:00Added an answer on June 2, 2026 at 12:08 pm

    After doing this

    $result=$this->_db_table->select()->where('name=?',$name)
        ->where('surname=?', $surname)->query()
        ->fetchAll();
    

    $result is already an array its not an object . So simply use it instead of calling toArray on it.

    Correct code wd be

    $result=$this->_db_table->select()->where('name=?',$name)
        ->where('surname=?', $surname)->query()
        ->fetchAll();
    
    return $result;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have very simple problem that I can't solve. I need to do something
I need something simple like date , but in seconds since 1970 instead of
I need something simple; I have page where a user clicks an author to
I have an apparently simple regex query for pipes - I need to truncate
I need to write a simple query in mySQL that would use MIN() in
I have one of these moments when something seems so simple but I just
I have a complex query that I need to use in a subsequent query
Ok, I think I might be overlooking something obvious/simple here... but I need to
I have a simple query like so: SELECT * FROM orders that returns all
I am working on a simple SQL select like query parser and I need

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.