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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:25:20+00:00 2026-06-01T03:25:20+00:00

The conventional way of doing this would be $row = mysql_fetch_array($query); echo $row[‘column’]; but

  • 0

The conventional way of doing this would be

$row = mysql_fetch_array($query);
echo $row['column'];

but I would like to know if it is possible to do something like

echo mysql_fetch_array($query)['column'];

I tried doing this on my local installation, but I get this error:

Parse error: syntax error, unexpected '[', expecting ',' or ';' in C:\Program Files (x86)\EasyPHP\www\array.php on line 5

This is mainly to reduce the number of lines in my code, as I’m writing a function that places a lot of mysql results into variables, and I don’t want to have code that looks like

$row = ...
$this->data[] = $row[];
$row = ...
$this->data[] = $row[];
...and so on
  • 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-01T03:25:21+00:00Added an answer on June 1, 2026 at 3:25 am

    You can use mysql_fetch_object() instead:

    echo mysql_fetch_object($query)->column;
    

    You can also use mysql_result() to retrieve a single field from the resultset:

    echo mysql_result($query, 0, 'column');
    

    Both cases are highly inappropriate though if you want to access more than a single column per row..

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

Sidebar

Related Questions

Or would a conventional client-server VCS be more appropriate? I'm currently using TortoiseSVN, but
I like to organize my Java files a little and would like to know
What is the conventional way to create an interface in OCaml? It's possible to
I am doing a procedure and it's working but I'm not sure if it'll
What is the correct way to design this database? Here is how I have
I feel like I'm unprofessional in the way I name and use iterators. What
In the conventional website a url displayed as: http://www.mySite.com/Topics would typically mean a page
Here's a real mystery. Imagine you are doing the conventional process of drawing a
Here's the workflow I'm coming up against. How would you solve this in git?
So basically I want to write a function that can be written like this:

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.