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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:12:58+00:00 2026-06-16T20:12:58+00:00

I am currently translating a PHP script from a PHP server of version 5.4

  • 0

I am currently translating a PHP script from a PHP server of version 5.4 to a PHP server with version 5.3

I immediately noticed a wierd behaviour in our login script.

After analysing the script for a bit, I found the source of the problem.

A call to a member of the first row in $result->fetch_row was invaild.

The declaration of $result is shown below:

$username = $mysqli->real_escape_string(strtolower($_POST["USERNAME"]));
$password = $mysqli->real_escape_string(md5(strtolower($_POST["PASSWORD"])));

$result = $mysqli->query("SELECT * FROM $table WHERE username='$username' AND password='$password'");

By instinct I checked if I had called the data_seek properly, however; I had.

Printing out the fetch_row() function gave me the following result

Array ( [0] => 3 [1] => admin [2] => d76362b0f640fbcf869033b5e4d1c4bf [3] => Mr [4] => Rasmus [5] => 4 [6] => [7] => 0 )

The array was therefore working.

But the following declaration did not work.

$Title = $result->fetch_row()[3];

Therefore I tried to store the entire row in a single array object, and then call all sub members individually.

Like so:

$row = $result->fetch_row();
$Title = $row[3];

And it worked perfectly.

How come? What is wrong with this declaration:

$Title = $result->fetch_row()[3];

  • 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-16T20:12:59+00:00Added an answer on June 16, 2026 at 8:12 pm

    The ability to reference the elements of a returned array directly from the calling method is introduced in PHP 5.4 – which is why it’s not working in 5.3.

    From Example #7 on http://php.net/manual/en/language.types.array.php

    As of PHP 5.4 it is possible to array dereference the result of a
    function or method call directly. Before it was only possible using a
    temporary variable.

    So your temporary solution looks like it will become a long-term one 🙂

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

Sidebar

Related Questions

currently I'm translating an app from C# into ActionScript (Silverlight to Flex) and I
I am currently translating my PHP application using gettext with POEdit. Since I respect
I'm currently translating an API from C# to Java which has a network component.
I'm currently translating an implementation of a checkers game from Ruby into Java. I
I'm currently translating an application from actionscript-3 to Java code and got stuck with
I am currently translating a program from QBasic to VB.Net and I have this
So, I'm working on translating my C++ app into multiple languages. What I'm currently
Currently, I'm working on a project where I have a server - client relationship
i'm having a problem translating the already working directions script in v2 to v3.
The project that I'm currently working on involves translating a website that was written

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.