Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.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
Javascript 悬停显示MySQL数据_Javascript_Php_Jquery_Mysql_Database - Fatal编程技术网

Javascript 悬停显示MySQL数据

Javascript 悬停显示MySQL数据,javascript,php,jquery,mysql,database,Javascript,Php,Jquery,Mysql,Database,我的网站上有一个MySQL输出脚本: $db_projects = "rex_projects"; $sql = new rex_sql; $sql->debugsql = 0; //Ausgabe Query $sql->setQuery("SELECT * FROM $db_projects ORDER BY id"); for($i=0; $i < $sql->getRows(); $i++) { $id = $sql->getValue("

我的网站上有一个MySQL
输出脚本

$db_projects = "rex_projects";

$sql = new rex_sql;

$sql->debugsql = 0; //Ausgabe Query

$sql->setQuery("SELECT * FROM $db_projects ORDER BY id");

for($i=0; $i < $sql->getRows(); $i++)
{

    $id = $sql->getValue("id");
    $projectname = $sql->getValue("projectname");
    $projectnumber = $sql->getValue("projectnumber");

    $print_projects .= '<div id="'.$id.'">'.$projectname.' has the number '.$projectnumber.'';

    $sql->next();
}
$db\u projects=“rex\u projects”;
$sql=新的rex_sql;
$sql->debugsql=0//Ausgabe查询
$sql->setQuery(“按id从$db_项目订单中选择*);
对于($i=0;$i<$sql->getRows();$i++)
{
$id=$sql->getValue(“id”);
$projectname=$sql->getValue(“projectname”);
$projectnumber=$sql->getValue(“projectnumber”);
$print_projects.='.$projectname.'的编号为'.$projectnumber';
$sql->next();
}
每个数据库元素都显示在具有上述格式的div中

我想实施的内容:

如果我悬停在一个div上,另一个div(下面的代码)应该显示这个元素的特定数据集。这可能吗?哪种方法最简单

<div id="specific-informations">
    Projectname: <?php echo $projectname ?><br>
    Projectnumber: <?php echo $projectnumber ?>
</div>

项目名称:
项目编号:
尝试添加以下脚本:

$(document).ready(function(){$( "#specific-informations" ).hide();
});
$( "#getinfo" ).mouseover(function() {
    $( "#specific-informations" ).fadeIn(2000);
});
$( "#getinfo" ).mouseout(function() {
    $( "#specific-informations" ).fadeOut(2000);
});

尝试添加以下脚本:

$(document).ready(function(){$( "#specific-informations" ).hide();
});
$( "#getinfo" ).mouseover(function() {
    $( "#specific-informations" ).fadeIn(2000);
});
$( "#getinfo" ).mouseout(function() {
    $( "#specific-informations" ).fadeOut(2000);
});

您可以执行以下操作:

在$print\u项目中创建第二个div

$print_projects .= <<<HTML
    <div id="$id" class="project">
        $projectname  has the number $projectnumber
        <div class="specific-informations">
            Projectname: $projectname<br>
            Projectnumber: $projectnumber
        </div>
    </div>
HTML;

您可以执行以下操作:

在$print\u项目中创建第二个div

$print_projects .= <<<HTML
    <div id="$id" class="project">
        $projectname  has the number $projectnumber
        <div class="specific-informations">
            Projectname: $projectname<br>
            Projectnumber: $projectnumber
        </div>
    </div>
HTML;

您可以调用一个ajax函数并返回结果。然后在div中绑定相应的ajax数据。

您可以调用一个ajax函数并返回结果。然后在div中绑定相应的ajax数据。

您当前的php不会出错吗<代码>不应该是
?id前面缺少$?您当前的php没有错误吗<代码>不应该是
?id前面缺少$?这不是我想要的结果。div始终显示。在div中应该出现特定的MySQL数据集。如果am将id为“3”的div悬停,id为“specific informations”的div应该显示第三个MySQL表元素中的所有数据集。是否要更改div的内容?div中的内容。这不是我想要的结果。div始终显示。div中应显示特定的MySQL数据集。如果am将id为“3”的div悬停,则id为“specific Information”的div应显示第三个MySQL表元素中的所有数据集。是否更改div的内容?div中的内容。