Php 为什么我能';你不能在每个模态中得到标题和注释吗?

Php 为什么我能';你不能在每个模态中得到标题和注释吗?,php,Php,while循环可以工作,我可以将每个标题显示为一个按钮,单击每个按钮时都有一个模式,但是在每个模式中,我不能显示标题和注释?为什么? 我曾经在while循环执行中包含了up-to-down,但是对于每个模式,我只得到了第一个标题和注释 如果有人对我的代码有疑问,请留下评论,请帮我修改代码:) 身体 { 保证金:0; } .提交{ 边际:0px; } 情态动词 { 宽度:100%; 身高:100%; 位置:固定; 排名:0; 显示:无; } .modal_close { 宽度:100%; 身高:

while循环可以工作,我可以将每个标题显示为一个按钮,单击每个按钮时都有一个模式,但是在每个模式中,我不能显示标题和注释?为什么?

我曾经在while循环执行中包含了up-to-down,但是对于每个模式,我只得到了第一个标题和注释

如果有人对我的代码有疑问,请留下评论,请帮我修改代码:)


身体
{
保证金:0;
}
.提交{
边际:0px;
}
情态动词
{
宽度:100%;
身高:100%;
位置:固定;
排名:0;
显示:无;
}
.modal_close
{
宽度:100%;
身高:100%;
背景:rgba(0,0,0,8);
位置:固定;
排名:0;
}
.结束
{
光标:指针;
}
.填充{
填充:20px 60px 60px 60px;
}
.注{
文本对齐:居中;
}
#注{
字体系列:爪哇文字;
}
.打电话给你{
字体系列:myFirstFont;
}
莫代尔霍梅因酒店
{
宽度:50%;
高度:400px;
背景:#fff;
z指数:4;
位置:固定;
最高:16%;
边界半径:4px;
左:24%;
显示:无;
-webkit动画持续时间:.5s;
-webkit动画延迟:.0s;
-webkit动画填充模式:两者都有;
-moz动画填充模式:两者都有;
-o-动画-填充模式:均为;
-webkit背面可见性:可见!重要;
-webkit动画名称:fadeInRight;
}
@-webkit关键帧fadeInRight{0%{opacity:0;-webkit变换:translateX(20px)}100%{opacity:1;-webkit变换:translateX(0)}
:-webkit输入占位符{
字体大小:13.4px;
}
.错误{
文本对齐:居中;
填充:170px;50px;50px 50px;
}
按钮
{
填充:20px;
边界半径:5px;
背景#8080;
边界:无;
字号:18px;
颜色:#fff;
利润率:8%;
}
$(文档).ready(函数(){
$(“.call_modal”)。单击(函数(){
$(“.modal”).fadeIn();
$(“.modal_main”).show();
});
});
$(文档).ready(函数(){
$(“.close”)。单击(函数(){
$(“.modal”).fadeOut();
$(“.modal_main”).fadeOut();
});
});
$(文档).ready(函数(){
$(“.submitted”)。单击(函数(){
$(“.modal”).fadeOut();
$(“.modal_main”).fadeOut();
});
});

看起来每个模式都需要某种唯一的标识符。这更多的是javascript问题,而不是php问题。我正在为每个便笺添加一个数据id,因为这似乎是唯一需要唯一的东西。显示模态,并显示一个相关注释

试着做一些更像这样的事情

echo '<button class="call_modal" data-id="{$row['id']}" style="cursor:pointer;">'. $row['title'] . '</button>';

它表示解析错误:语法错误,意外的“id”(T_字符串),应为“,”或“;”联机回显“”$行['title'].';
echo '<button class="call_modal" data-id="{$row['id']}" style="cursor:pointer;">'. $row['title'] . '</button>';
<div class="modal">
<div class="modal_close close"></div>
<div class="modal_main">
<?php $results = mysqli_query($con, "SELECT * FROM note"); ?>
<?php while ($row = mysqli_fetch_array($results)) { ?>
<div class="note" data-id="<?= $row['id'] ?>">
$(document).ready(function(){
  $(".call_modal").click(function(){
    $(".modal").fadeIn();
    $(".modal .note[data-id='"+$(this).data('id')+"']").show();
  });
});