0
PHP while 루프를 사용하여 출력하는 모든 항목에 대해 jQuery 클릭 기능을 사용하려면 도움이 필요합니다. 첫 번째 루프에서만 작동합니다.jQuery에서 루프의 각 항목에 대한 이벤트를 클릭하십시오.
클릭 기능을 트리거 할 때 사용자에게 메시지를 표시하려면 팝업 창을 열어야합니다.
PHP :
<?php
$query = mysql_query("SELECT * FROM message WHERE to_mem='$from_mem' AND
to_mem_burn='2' AND new_message='3' ORDER BY id DESC");
$num_rows = mysql_num_rows($query);
if ($num_rows < 1) {
echo '<div id="new_message" class="addlinkuplinks a"> You have no
message at this time. </div>';
} else {
while($row = mysql_fetch_array($query)){
$msg_id = $row['id'];
$msg_to_mem = $row['to_mem'];
$msg_from_mem = $row['from_mem'];
$msg_from_memID = $row['from_memID'];
$msg_subject = $row['subject'];
$msg_content = $row['content'];
$msg_date = $row['date'];
$msg_from_mem_burn = $row['from_mem_burn'];
$msg_to_mem_burn = $row['to_mem_burn'];
$sqlName=mysql_query("SELECT * FROM members WHERE email<>'$from_mem'
AND email='$msg_from_mem' LIMIT 1")or die ("Sorry we have a mysql error!");
while($row=mysql_fetch_array($sqlName)){
$msg_from_memAccount=$row["accountType"];
$msg_from_memID=$row["hdw_id"];
$msg_from_memfirstName=$row["firstName"];
$msg_from_memlastName=$row["lastName"];
$msg_from_mem_pic=$row["profile_pic"];
$gender=$row["gender"];
}
echo '
<div id="linkUPmsg" class="linkUPmsg">
<table width="100%">
<tr>
<tr><td width="60%"align="left" valign="top"><span style="font-size:
12px; color: #CCCCCC;">Read Date:</span></td>
<td width="40%"align="right" valign="top"><span style="font-size: 12px; color:
#CCCCCC;">'.$msg_date.'</span></td>
</tr>
<table width="100%">
<tr>
<td width="5%" align="left">'.$profile_pic.'</td>
<td width="87%"align="left" ><span style="font-size: 14px; font-
weight: bold; color:#999999;">'.$msg_from_memfirstName.'
'.$msg_from_memlastName.'</span>
<div id="requestlinkUP_text">Send you this message!</div>
<div id="requestlinkUP_text"">Subject: <span style="font-size: 12px;
font-weight: bold; color: #0066CC;">'.$msg_subject.'</span></div>
</td>
<div id="member_msg"></div>
<td width="3%" align="right"><div id="linkUPmsg_read"
class="msgAction"">
<a href="#"><img src="/image/read_mail.png" width="41"
height="27" /></a>
</div>
<div id="popupboxrContact">
<div id="memberslinkup" class="msgdiv"></div>
<div id="formbox" class="form_border" >
<div class="tittle_border"><table width="100%" bgcolor="#F30"
style="opacity: 0.7;">
<tr>
<td>
<a id="popupboxrContactClose" class="popupboxClose">Close</a>
<span style="text-align: center; font-size: 18px; font-weight: bold; color:
#CCC;">Reading Message</span></td>
</tr>
</table></div><p></p>
<p></p>
<table width="100%">
<tr>
<tr><td width="60%"align="left" valign="top"><span style="font-size:
12px; color: #CCCCCC;">Read Date:</span></td>
<td width="40%"align="right" valign="top"><span style="font-size: 12px; color:
#CCCCCC;">'.$msg_date.'</span></td>
</tr>
<table width="100%">
<tr>
<td width="5%" align="left">'.$profile_pic.'</td>
<td width="87%"align="left" ><span style="font-size: 14px; font-
weight: bold; color: #999999;">'.$msg_from_memfirstName.'
'.$msg_from_memlastName.'</span>
<div id="requestlinkUP_text">Send you this message!</div>
<div id="requestlinkUP_text"">Subject: <span style="font-size: 12px;
font-weight: bold; color: #0066CC;">'.$msg_subject.'</span></div>
</td>
</tr>
</table>
</div>
</div>
<div id="bgPopupboxr"></div>
</td>
<div id="member_msg"></div>
<td width="3%" align="right"><div id="linkUPmsg_read"
class="addlinkuplinks"><form id="readForm" action="" class="form" method=""
enctype="multipart/form-data" name="acceptlinkUP">
<input name="read_linkUPmsg" class="msgAction" type="image"
src="/image/mail_reply.png" /></form></div></a>
</td>
<div id="member_msg"></div>
<td width="2%" align="right"><div id="linkUPmsg_burn"
class="addlinkuplinks"><form id="burnForm" action="/burn_message.php" class="form"
method="get" enctype="multipart/form-data" name="burnlinkUP">
<input name="msg_id" type="hidden" value="'.$msg_id.'" />
<input name="to_mem" type="hidden" value="'.$msg_from_mem.'" />
<input name="burn_linkUPmsg" class="msgAction" type="image"
src="/image/burn_sign.png" />
</form></div></a>
</td>
</tr>
</table>
</span>
</div>
';
}
}
?>
jQuery를 :
나는 HTML 코드 중 어느 것도 HTML 루프 내부에없는 보는 것과var popupboxrStatus = 0;
function loadPopupboxr(){
if(popupboxrStatus==0){
$("#bgPopupboxr").css({
"opacity": "0.4"
});
$("#bgPopupboxr").fadeIn("slow");
$("#popupboxrContact").fadeIn("slow");
popupboxrStatus = 1;
}
}
function disablePopupboxr(){
if(popupboxrStatus==1){
$("#bgPopupboxr").fadeOut("slow");
$("#popupboxrContact").fadeOut("slow");
popupboxrStatus = 0;
}
}
function centerPopupboxr(){
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupboxrHeight = $("#popupboxrContact").height();
var popupboxrWidth = $("#popupboxrContact").width();
$("#popupboxrContact").css({
"position": "absolute",
"top": windowHeight/2-popupboxrHeight/2,
"left": windowWidth/2-popupboxrWidth/2
});
$("#bgPopupboxr").css({
"height": windowHeight
});
}
$(document).ready(function(){
$(".msgAction").click(function(){
//center
centerPopupboxr();
//load popupBox
loadPopupboxr();
});
$("#popupboxrContactClose").click(function(){
disablePopupboxr();
});
$("#bgPopupboxr").click(function(){
disablePopupboxr();
});
});
거기에는 PHP가 없습니다. –
PHP 코드가 보이지 않으므로 어디에 문제가 있습니까? –
while 루프는 어디에 있습니까? – jro