T
T
testertoster2020-06-10 16:37:35
PHP
testertoster, 2020-06-10 16:37:35

How to send data to the database?

Hello. Recently there was a task to create the test. The essence of the problem is as follows. It is necessary that the user can register, take the test and get the number of answers in percentage, and his answers are sent to the database and displayed in the admin panel.

How to make a user registration is clear to me and how to make the test itself too. The problem is the output sending responses to the database and displaying them on the user's screen. Please provide some information on this matter.

PS Php I'm just learning ;)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2020-06-10
@Stalker_RED

"sending" to the database https://dev.mysql.com/doc/refman/8.0/en/insert.html
output to the screen https://www.php.net/manual/ru/function.echo.php

S
Sergey, 2020-06-10
@rakot90

Since registration is "clear", then there should be no questions about saving / displaying the results either ...
For example, collect answers in JSON format (if you're interested "how else can you") and write to the database (+id_test_user, datetime). If it’s difficult, then do without JSON and decompose the answers into database fields, at the same time it will be easier to calculate statistics.
Output by reading from the database:
if all testees (admin) are needed - all fetch_array to help,
if there is one specific record, then select by id_test_user, then fetch_array , and then expand JSON.
Z.Y. It would be nice to indicate what / on what the test is written (framework, cms)...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question