我试图将数据库中的多行输出到一个数组中,但它只选择最后一行,我该如何解决这个问题?
$getSkills = $db->query("SELECT * FROM _skills WHERE `chara_id` = '$cid'");
while ($skill = mysql_fetch_assoc($getSkills)) {
$sid = $skill['id'];
$sname = $skill['name'];
$url = $skill['url'];
}
$data = array('skills' => array( '<img id="'.$sid.'" class="skill" src="'.$url.'">','<img id="'.$sid.'" class="skill" src="'.$url.'">','<img id="'.$sid.'" class="skill" src="'.$url.'">','<img id="'.$sid.'" class="skill" src="'.$url.'">' ));
<div class="skill_images"><img id="3" class="skill" src="/img/skills/5.png">
`