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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:32:23+00:00 2026-05-26T00:32:23+00:00

Not sure if the title is exactly what i want to do. Below is

  • 0

Not sure if the title is exactly what i want to do. Below is my working code.

        mysql_select_db($_POST[database]);
        $table_list = mysql_query('SHOW TABLES');
        $tables_in_db = "Tables_in_" . $_POST[database];
        while ($row = mysql_fetch_object($table_list)) {
            echo "<tr>
                    <td class='pageBody'>" . $row->$tables_in_db . "</td>
                  </tr>";
        }

Is it possible to remove line 4 and access the object attribute with $row->Tables_in_{$_POST[database]} in some manner? I’ve tried a couple different ways including various placing of quotes and curly braces, i had to resort to assigning the whole attribute to the variable $tables_in_db and then use that variable to access the attribute.

  • 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-26T00:32:23+00:00Added an answer on May 26, 2026 at 12:32 am

    You have the right idea, just not the proper syntax. Variable properties can either take the form of a single variable ($a->$b) or some other expression that returns a string containing the name of the property ($a->{'b'}).

    $row->{'Tables_in_' . $_POST['database']}
    

    Aside: using one of the other mysql_fetch_* functions, knowing the column name would become irrelevant. For example, mysql_fetch_array() or mysql_fetch_row() and accessing the $row[0] item.

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

Sidebar

Related Questions

I'm getting the error mentioned in the title and not sure what exactly I
The question title is a bit strange because I'm not exactly sure how to
Not entirely sure my question title describes what I want to do, but couldn't
Firstly, apologies for the vague title, but I'm not sure exactly what I'm asking
Sorry for the vague title, but I'm not exactly sure how I can explain
So I'm not exactly sure if the title fits it best, but here's what
NOTE: I am not exactly sure how to title or tag this question, so
Not exactly how sure how to title this question, so I hope the title
My title is somewhat vague, because I'm not exactly sure how to ask what
Sorry, I wasn't sure exactly what title to give this and have not been

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.