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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:38:40+00:00 2026-06-09T08:38:40+00:00

I am having trouble in returning data in php from an SQL query. here

  • 0

I am having trouble in returning data in php from an SQL query. here is my code:

      public function get_audit_message($productId,$accountId)
        {
        $sql_list  ="SELECT notes
                     FROM  ".$this->tables_audit."
                     WHERE productId = '".mysql_real_escape_string($productId)."'
                     AND accountId = '".mysql_real_escape_string($accountId)."'
                     ";

        $query = $this->db->query($sql_list);
        if($query->num_rows() > 0)
            {
            $return = $query->result_array();
            return $return;
            }
        else return false;
        }

the reason I am having trouble is that as it is at return $return; returns the correct number of results but only displays the word “array”. then if i change it to return $return[0]; returns the first entry of information correctly.

So what i want to be able to do is select all array numbers e.g return $return[*]; if only was possible.

Any suggestions would be much appreciated.

  • 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-09T08:38:43+00:00Added an answer on June 9, 2026 at 8:38 am

    There is several easy ways to display content of PHP Array in HTML.

    The most simple is to view it via print_r command like this:

    print_r ($my_array);
    

    If you need to be “nice” formatted, add PRE tag like this:

    echo "<pre>";
    print_r($my_array);
    echo "</pre>";
    

    or like this:

    echo "<pre>".print_r($my_array, 1)."</pre>";
    

    Also, there is similar var_dump and var_export PHP function:

    echo "<pre>";
    var_dump($my_array);
    echo "</pre>";
    

    or

    echo "<pre>";
    var_export($my_array);
    echo "</pre>";
    

    Just choose your preferred stile.

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

Sidebar

Related Questions

I am having trouble returning data from my sql-server database to an aspx page
I'm having trouble returning data from my controller using an ajax post function. What
I'm having trouble bringing back data from my PHP file. I guess I don't
I'm having trouble developing a standard for returning data from user functions passed and
I am having some trouble returning matrix data from one method to the main
Having trouble with each function... Will try to explain by example... In my code,
I am having trouble in returning compressed response (GZip) from my Java Servlet, to
im having trouble returning an array that contains decimal values to a variable: function
I'm trying to get a query from a specific model. I'm having trouble getting
I'm having trouble trying to export saved data from CoreData to a CSV file.

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.