MySQL Forums
Forum List  »  PHP

Schem Comment as Table Header
Posted by: Dave Ellis
Date: January 16, 2021 06:21AM

If anyone could help with the following it would be greatly appreciated.

I am running a script on a wordpress website that submits form information into a database table.
The scenario is this:
The question title field in the form is classed as MCQ1. MCQ2 etc in the table column id of the database. The actual title text is saved as a comment in the table, so when trying to retrieve the data to an html table on the website, the question text is MCQ1 instead of the actual question text for example "what is your name?"

Is there any way of replacing MCQ1 with the actual question text from the comment schema?
Example:
DATABASE TABLE/COLUMNS
+--------------+----------------------------+
| id | comment |
+--------------+----------------------------+
| MCQ1 | What is your name? |
| MCQ2 | How old are you? |
| MCQ3 | What colour are your eyes? |
| MCQ4 | Where do you live? |
+--------------+----------------------------+

OUTPUT I AM TRYING TO ACHIEVE AS AN HTML TABLE ON WEB PAGE
+---------------------------------+------------------------+
| QUESTION | ANSWER |
+---------------------------------+------------------------+
| comment text instead of MCQ1 | YES |
| comment text instead of MCQ2 | NO |
| comment text instead of MCQ3 | YES |
| comment text instead of MCQ5 | YES |
+---------------------------------+------------------------+

I am out of ideas on this one and not highly proficient with mysql.
Thankyou

Options: ReplyQuote


Subject
Written By
Posted
Schem Comment as Table Header
January 16, 2021 06:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.