Answer the question
In order to leave comments, you need to log in
How to correctly select and display an associative array from related tables?
Related tables by skills_id, you need to display an associative array in php, I do this:
$db = Db::getconnection();
$skillslist = [];
$result = $db->query('SELECT * FROM skills LEFT OUTER JOIN about ON skills.skills_id = about.skills_id');
$result -> execute();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$skillslist[$row['skill_name']][] =$row;
}
//$row = $result->FETCHALL(PDO::FETCH_COLUMN|PDO::FETCH_GROUP);
return $skillslist;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question