Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用JQuery在图像旁边显示数据库信息?_Php_Jquery_Html_Css - Fatal编程技术网

Php 如何使用JQuery在图像旁边显示数据库信息?

Php 如何使用JQuery在图像旁边显示数据库信息?,php,jquery,html,css,Php,Jquery,Html,Css,大家好,我想在图库中的每个不同图像上显示数据库中的任何类型的信息(),非常类似,但我不知道怎么做,有人有解决方案吗 顺便说一句,我使用的是SQLServer2008 这就是我目前所拥有的 Index.html <!DOCTYPE html> <html> <head> <title>Tablero</title> <link rel="stylesheet" href="css/style.

大家好,我想在图库中的每个不同图像上显示数据库中的任何类型的信息(),非常类似,但我不知道怎么做,有人有解决方案吗

顺便说一句,我使用的是SQLServer2008

这就是我目前所拥有的

Index.html

<!DOCTYPE html>
<html>
    <head>
        <title>Tablero</title>
        <link rel="stylesheet" href="css/style.css">
        <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    </head>
    <body>
        <section class="tagline">
            <h1>Jueces</h1>
        </section>
        <div id="container">
            <h1 id="heading"> Projects</h1>
            <ul id="gallery"></ul>
        </div>
        <script>
            $(document).ready(function() {
                setInterval(function() {
                    $("#container").load('connection.php');
                }, 1000);
            });
        </script>

    </body>
</html>

您的代码看起来不错,这是对Connection.php的重写(略有不同),图像旁边有一个数据库信息示例

<?php
$server="localhost";
$user="perron";
$password="hasg";
$database="ejemplo";

$conn = odbc_connect("Driver={SQL Server Native Client 10.0}; Server=$server; Database=$database;", $user, $password);

$sql = "SELECT * FROM Prueba";

$rs = odbc_exec( $conn, $sql );
if ( !$rs ) { exit( "Error en la consulta SQL" ); }
?>

<div class="container">
<div id="container">
    <h1 id="heading"> Projects</h1>
    <ul id="gallery">
  <?php 
$li = "";
while (odbc_fetch_row($rs)) {
  $resultado_img=odbc_result($rs, "img");
  $resultado_id=odbc_result($rs, "id");
  $resultado_nombre=odbc_result($rs, "nombre");
  $resultado_fecha=odbc_result($rs,"fecha_aud");
  $resultado_hora=odbc_result($rs,"hora_aud");
  $resultado_juzgado=odbc_result($rs,"juzgado");            
  $li.="<li><img src=\"img/".$resultado_img."\" alt=\"\" height=\"200\" width=\"200\" />";
  $li.="<div id=\"info\">".$resultado_nombre;
  $li.="<br>".$resultado_fecha;
  $li.="<br>".$resultado_hora;
  $li.="<br>".$resultado_juzgado."<div></li>";
        } 
  echo $li;  
        ?>
     </ul>
</div>
</div>
#李画廊{
显示:块;
浮动:左;
宽度:100%;
光标:指针;
边界半径:5px;
框大小:边框框;
利润率:0 12px 7px 0;
}
#画廊图片{
宽度:25%;
浮动:左;
边界半径:5px;
}
#画廊信息{
宽度:70%;
浮动:左;
左侧边缘:.5em;
显示:无;
}

  • id
    名称
    文本
    文本
您的代码看起来不错,这是对Connection.php的重新编写(略有不同),图像旁边有一个数据库信息示例

<?php
$server="localhost";
$user="perron";
$password="hasg";
$database="ejemplo";

$conn = odbc_connect("Driver={SQL Server Native Client 10.0}; Server=$server; Database=$database;", $user, $password);

$sql = "SELECT * FROM Prueba";

$rs = odbc_exec( $conn, $sql );
if ( !$rs ) { exit( "Error en la consulta SQL" ); }
?>

<div class="container">
<div id="container">
    <h1 id="heading"> Projects</h1>
    <ul id="gallery">
  <?php 
$li = "";
while (odbc_fetch_row($rs)) {
  $resultado_img=odbc_result($rs, "img");
  $resultado_id=odbc_result($rs, "id");
  $resultado_nombre=odbc_result($rs, "nombre");
  $resultado_fecha=odbc_result($rs,"fecha_aud");
  $resultado_hora=odbc_result($rs,"hora_aud");
  $resultado_juzgado=odbc_result($rs,"juzgado");            
  $li.="<li><img src=\"img/".$resultado_img."\" alt=\"\" height=\"200\" width=\"200\" />";
  $li.="<div id=\"info\">".$resultado_nombre;
  $li.="<br>".$resultado_fecha;
  $li.="<br>".$resultado_hora;
  $li.="<br>".$resultado_juzgado."<div></li>";
        } 
  echo $li;  
        ?>
     </ul>
</div>
</div>
#李画廊{
显示:块;
浮动:左;
宽度:100%;
光标:指针;
边界半径:5px;
框大小:边框框;
利润率:0 12px 7px 0;
}
#画廊图片{
宽度:25%;
浮动:左;
边界半径:5px;
}
#画廊信息{
宽度:70%;
浮动:左;
左侧边缘:.5em;
显示:无;
}

  • id
    名称
    文本
    文本
上面的代码到底有什么问题???上面的代码没有问题,但我不知道如何在悬停或类似的RedBox上显示数据库中的信息,他们在图像旁边的悬停位置显示电影的信息,我想在我的代码中这样做我已经用鼠标图像旁边显示的文本演示更新了我的答案上面的代码到底有什么问题???上面的代码没有问题,但我不知道如何在鼠标悬停或类似RedBox上显示数据库中的信息,它们在图像旁边的悬停中显示电影信息,我想在我的代码中这样做。我用鼠标悬停图像旁边的文本演示更新了我的答案。你真的帮了我很大的忙,非常感谢这正是我想要的:D@Phantom_strike很高兴这很有用:)哇,你真的帮了我很多,非常感谢这正是我想要的:D@Phantom_strike很高兴这有帮助:)
<?php
$server="localhost";
$user="perron";
$password="hasg";
$database="ejemplo";

$conn = odbc_connect("Driver={SQL Server Native Client 10.0}; Server=$server; Database=$database;", $user, $password);

$sql = "SELECT * FROM Prueba";

$rs = odbc_exec( $conn, $sql );
if ( !$rs ) { exit( "Error en la consulta SQL" ); }
?>

<div class="container">
<div id="container">
    <h1 id="heading"> Projects</h1>
    <ul id="gallery">
  <?php 
$li = "";
while (odbc_fetch_row($rs)) {
  $resultado_img=odbc_result($rs, "img");
  $resultado_id=odbc_result($rs, "id");
  $resultado_nombre=odbc_result($rs, "nombre");
  $resultado_fecha=odbc_result($rs,"fecha_aud");
  $resultado_hora=odbc_result($rs,"hora_aud");
  $resultado_juzgado=odbc_result($rs,"juzgado");            
  $li.="<li><img src=\"img/".$resultado_img."\" alt=\"\" height=\"200\" width=\"200\" />";
  $li.="<div id=\"info\">".$resultado_nombre;
  $li.="<br>".$resultado_fecha;
  $li.="<br>".$resultado_hora;
  $li.="<br>".$resultado_juzgado."<div></li>";
        } 
  echo $li;  
        ?>
     </ul>
</div>
</div>