Z
Z
Zina-20002021-06-17 15:25:31
PHP
Zina-2000, 2021-06-17 15:25:31

How to display data from the database on the page?

When an authorized user makes an order on the site, the order data (id, id_user, name, price, data, status) is added to the database. How to display this data in the user's personal account?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2021-06-17
@sslion

make a request to the database, get the desired record, and display it on the page using html markup (or use some kind of Twig template engine)

V
Viktor Batienko, 2021-06-17
@xaker01

The problem is probably to understand how exactly to display the record the user needs?
You can redirect it to the page site.ru/order/order
id and get a record from the url by the order id.
Or save the order ID in cookies. and carry through it

S
Stalker_RED, 2021-06-17
@Stalker_RED

Display a list with the history of orders On each of them, make a link like /order/42 When you go to the order page, pull out the desired order
select * from orders where user_id=123

select * from orders where order_id=42 AND user_id=123

Please note that user_id is also checked so that other people's orders are not viewed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question