Answer the question
In order to leave comments, you need to log in
How to put all table values in one array?
php. I have a table with many fields. The fields consist of id and name. It is necessary to bring the name value of all fields into one large array. How to do it?
Answer the question
In order to leave comments, you need to log in
$host = ""; //Хост бд
$name = ""; // Имя бд
$user = ""; // Имя пользователя
$password = ""; // Пароль пользователя
$query = ""; // Запрос
try {
$database = new PDO("mysql:host=$host;dbname=$name;charset=utf8", $user, $password);
$database->EXEC("SET NAMES utf8");
} catch(PDOException $e) {
die("Подключение не удалось: ". $error -> getMessage());
exit;
}
$query = $database->prepare($query);
$query->execute();
$result = $sequery->fetchAll();
echo var_dump($result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question