[英]Mouse Over - Show MYSQL Data
到目前为止,我有以下代码:
<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "password";
$mysql_database = "test_db";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Oops some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Oops some thing went wrong");// we are now connected to database
$location = "";
$result = mysql_query("SELECT * FROM assets natural join loc_admin natural join id_info WHERE assets.id_location LIKE '$location%'");
echo '<table border=1px>'; // opening table tag
echo'<th>ID</th><th>ID_Location</th><th>Room</th><th>Device Type</th><th>Model</th><th>Version</th><th>Firmware</th><th>Manufacturer</th><th>Tech_Name</th>'; //table headers
while($data = mysql_fetch_array($result))
{
// we are running a while loop to print all the rows in a table
echo'<tr>'; // printing table row
echo '<td>'.$data['idassets'].'</td><td>'.$data['id_location'].'</td><td>'.$data['room_number'].'</td><td>'.$data['device'].'</td><td>'.$data['model'].'</td><td>'.$data['version'].'</td><td>'.$data['firmware'].'</td><td>'.$data['manufacturer'].'</td><td>'.$data['tech_name'].'</td>'; // we are looping all data to be printed till last row in the table
echo'</tr>'; // closing table row
}
echo '</table>'; //closing table tag
?>
效果很好-我可以在3个表中的每一个中显示所有信息。
现在,我只显示上面的内容,但是我想将鼠标悬停在名为id_info的数据库中显示数据(站点信息),并且当我将鼠标悬停在初始位置时,其中的行具有location_name,location_email等id_location。 我正在尝试找出简单的方法。 谢谢您的帮助。 我花了一些时间才到达显示数据并建立所有表之间的关系的位置。
您可以使用工具提示在鼠标悬停时显示数据库中的结果
<a href="#" data-toggle="tooltip" title=" <?php echo $data['location_name'].$data['location_email'];?> " > link </a>
我认为您需要一些Ajax脚本,该脚本可以直接在悬停框中打印这些信息。 据我所知,没有PHP函数可以满足您的要求。
得到它的工作,
我用下面的网址。 真的很好
http://hscripts.com/tutorials/html/tooltip.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.