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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:43:46+00:00 2026-05-13T19:43:46+00:00

What I am trying to do is display the Table name then each of

  • 0

What I am trying to do is display the Table name then each of it’s field names after it.
it seems to work until i get to my character table, it will not display the field names and returns me this error.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘character’ at line 1

I looked at upgrading my MySQL but nothing happen I still managed get the error.

$showtablequery = "SHOW TABLES";
$showtablequery_result  = mysql_query($showtablequery);
while($showtablerow = mysql_fetch_array($showtablequery_result))
{
        echo "<b>$showtablerow[0]</b> - ";

        $showcolumnquery = "SHOW COLUMNS FROM $showtablerow[0]";
        $showcolumnquery_result = mysql_query($showcolumnquery) or die("Query failed with error: ".mysql_error());

        while($showcolumnfield = mysql_fetch_array($showcolumnquery_result))
        {
            echo "$showcolumnfield[0] | ";
        }
        echo "<br /><br />";
}
  • 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-13T19:43:46+00:00Added an answer on May 13, 2026 at 7:43 pm

    Wrap your table name in ` (tick marks) so that it doesn’t interpret the table name as a command.

    That should fix your problem.

    "SHOW COLUMNS FROM `$showtablerow[0]`";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a layout with display: table and alike, but it seems
I'm trying to pass table names to a sub that gets all the field
I'm trying to display a table full of twitter statuses (yes, this is the
Made solution change: I am trying to display a html table of data.. In
I'm trying to inherit QSqlTableModel to make data im my table display in way
I'm trying to understand this bit of code: in display.php: <html> ... <body> <table>
I am trying to retrieve data from mysql then display it on android listview.
I am trying to load JSON from a sever and then display it in
I am trying to display a list of friends names ie: first_name and last_name.
I am entering some data into this database and then trying to display that

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.