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

  • Home
  • SEARCH
  • 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 4084364
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:25:50+00:00 2026-05-20T18:25:50+00:00

I am calling a search function from my object and in return i want

  • 0

I am calling a search function from my object and in return i want to send the result plus some message so can i return two variable one with array and one with the message like $data and $message

$this->query=("select * from user where pno='".$search."'");
$rd = $this->executeQuery();
return @$data = $rd->fetch_assoc();

return $message;

when it get back to

$result=$user->search($result);

how can i fetch the result from it
Thanks

  • 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-20T18:25:51+00:00Added an answer on May 20, 2026 at 6:25 pm

    While @moe’s answer is perfectly correct, you probably don’t want to do that for error handling.

    Why?

    Because next you’ll find yourself having to return a two-element array from every function with the real data in one element and a possible error in the other, and then you’re going to need to check the error every single time, even if you can’t do anything about it.

    That’s gonna get tedious really quick.

    You’re dealing with errors, so treat them like errors! When an error happens, throw an exception. If the calling code can elegantly recover from an error, it can look for and expect to deal with the exception. If the calling code can’t recover from an error, then the exception will crawl up the chain until it hits a default exception handler, which you can configure to elegantly and delicately handle the responsibility of telling the user that something broke.

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

Sidebar

Related Questions

I try to fetch some data from Plurk using its search function. http://www.plurk.com/API#search I
am calling a webservice from my jquery as $.ajax({ type: POST, url: /DataService.asmx/Search, contentType:
I need to return a custom object in a WCF service to a calling
I am calling a server side function to return a json format string and
I have a Search Result Page where people can enter word they would like
once we send email from php using mail() function, is there any way to
Possible Duplicate: Calling a Function From a String With the Function's Name in Ruby
Hello please help me out regarding returning the variable from the function I am
How can I pull multiple rows from a database using a function? The function
Calling the WriteObject Method from a background thread is not possible! Is there a

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.