G
G
geniusperson2018-06-18 19:29:04
PHP
geniusperson, 2018-06-18 19:29:04

How to retrieve user settings from database in php?

Hello everyone, I need a little help, how can I take user data from the database and push it into php?
Example:
Here is the user's data, from here you need to display code and code2 in php
5b27dc777f9be495946670.png
as I tried to display all this in php :)
5b27dd22a584f187494971.png
i.e. you need to store data from the database in the php file, each user's data is different

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Malinichev, 2018-06-18
@malinichev

Well, it's kind of simple here ... Let's say the file name will be 1.json, where 1 is the id of the desired user. And write JSON data to this file: json_encode($data)

V
Vitaly, 2018-06-18
@rim89

If you have a database, why store data in PHP?
PHP script started, suffered and died.
If you wanted to take them out, then

$query = "SELECT code, code2 FROM user"; //если надо для всей таблицы
$query = "SELECT code, code2 FROM user WHERE id = 32"; //если надо для пользователя с ID 32

As a result, in the query you will have a database object with a selection
. After, depending on the selected class of working with the database, you process and insert where you need
more details here - https://phpclub.ru/detail/article/mysqli

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question