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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:46:42+00:00 2026-06-10T04:46:42+00:00

I am trying to have an array of data that I can pull out

  • 0

I am trying to have an array of data that I can pull out from my table like that:

echo $message_data['content'];

so I declare $message_data like that:

     $message_data = message_data($_GET['id'],'id' ,'content', 'sender', 'addressee','support','date');

And the message_data() function is written like that:

function message_data($message_id) {
$data = array();
$message_id = (int)$message_id;

$func_num_args = func_num_args();
$func_get_args = func_get_args();

if($func_num_args > 1)
{
    unset($func_get_args[0]);

    $fields = '`'  .  implode('`, `' , $func_get_args) . '`';
    $data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `messages` WHERE `id` = $message_id") or die(mysql_error()));
    return $data;
} }

This function does work similarly when I try to pull data about the user, I just copied and pasted it and tweaked it slightly.
The problem is, there are no errors, and yes, I do input the browser with a GET variable.
Where is the error? Or if there is a better way to do this, I’d be glad to hear.

Thanks a lot.

  • 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-10T04:46:44+00:00Added an answer on June 10, 2026 at 4:46 am
    $data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `messages` WHERE `id` = $message_id") or die(mysql_error()));
    

    This line is the issue, inside the brackets it seems foo() or bar() equals to foo() || bar(), it’s not what you want, so put it out side like this:

    $res = mysql_query("SELECT $fields FROM `messages` WHERE `id` = $message_id") or die(mysql_error());
    $data = mysql_fetch_assoc($res);
    

    edit:

    Just don’t use or like this, or at least don’t use the return value of the or like that.

    Normally,

    A or B
    

    if A is false, then PHP will check B; if A is true, then there’s no need to check B.

    but I guess

    $c = A or B
    

    is actually

    ($c = A) or B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model that I'm trying to retrieve an array of data from,
I have an array of data that looks like this: 2008, Honda, Accord, Used,
i am trying to pull data from one table, compare columns to a variable,
I have some data that I am trying to insert into a table that
I have two arrays of data that I'm trying to amalgamate. One contains actual
I am trying to sort an array. I have an array of data, where
I have an array of raw sound data samples, and I'm trying to make
I have an array of Bitmaps that I'm trying to convert into an array
I have an array of URL Links that I'm trying to load into a
I'm trying to build a PHP function that allows me to have an array

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.