W
W
wixtransfer2018-04-09 07:18:14
PHP
wixtransfer, 2018-04-09 07:18:14

How to make a SELECT of the same COLUMN and throw the result into an array?

Hello! Let's say there is a users table with columns name, city, age.
And now the pseudo code: Oh great phpMyAdmin, select the lines where AGE==18 and put their NAME into the $name array so that it looks like this:
$name[0] is Vasya
$name[1] is Petya
, etc.
How to do it?
Thanks in advance for your reply!
PS. Tried like this but didn't work

$b = mysqli_query ($c, "SELECT name FROM users WHERE age LIKE '18'");
$names = mysqli_fetch_row($b);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2018-04-09
@wixtransfer

"select * from users where age=18"
then by iterating over in php - foreach () you create a new array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question