我需要在鼠标悬停时使用数据库(如下图所示)从数据库中获取和显示数据,并在鼠标关闭时消失。
这是模型
public function teacher_with_subject(){
$this->db->select('*')
->from('teacher AS t')
->join('teacher_subject ts','t.computer_number=ts.computer_number', 'left')
->where('t.date_of_termination','0000-00-00')
->where('ts.date_of_end','0000-00-00');
$query = $this->db->get(); return $query->result_array();
}
控制器
$located=$this->select_model->teacher_with_subject();
查看: -
if (count($located) > 0) {
echo '<table>';
foreach($located as $locate){
echo "<tr><td>".$locate['computer_number']."</td><td>".$locate['name']."</td><"</td><td><img src=". base_url()."inc/images/confirm.png width='45' height='30' border='0' class='computer_number' data-id='".$locate['computer_number']."'/></td></tr>";
}
echo '</table>';
}
我希望在鼠标名称显示时显示邮寄地址和电子邮件地址
答案 0 :(得分:0)
使用title属性:
echo "<tr>";
echo "<td>".$locate['computer_number']."</td>";
echo "<td title='".$locate["email"]."<br />".$locate["address"]."'>".$locate['name']."</td>";
echo "<td><img src=". base_url()."inc/images/confirm.png width='45' height='30' border='0' class='computer_number' data-id='".$locate['computer_number']."'/></td>";
echo "</tr>";