到目前为止,我有以下代码:
<?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。我正在尝试找出简单的方法。谢谢您的帮助。我花了一段时间才到达这一点,显示数据并建立所有表格的关系。
答案 0 :(得分:0)
您可以使用工具提示在鼠标悬停上显示数据库的结果
<a href="#" data-toggle="tooltip" title=" <?php echo $data['location_name'].$data['location_email'];?> " > link </a>
答案 1 :(得分:-1)
我认为您需要一些Ajax脚本,可以直接在悬停框中打印这些信息。据我所知,没有PHP功能可以满足您的要求。
答案 2 :(得分:-1)
让它发挥作用,
我使用了下面的网址。效果很好
http://hscripts.com/tutorials/html/tooltip.php