0
나는 CSS 모달 창이 있습니다. 나는 SQL 결과를 표시하고 싶습니다. 내가 링크를 클릭하면. 링크를 클릭하면 <a href="index.php?idi='.$id.'">
에서 ID를 가져 와서 데이터베이스에서 데이터를 선택하고 팝업에서 표시합니다. 여기에서 팝업 코드 index.php
을 볼 수 있습니다. 하지만이 작동하지 않습니다, 나는 당신이 $popList
변수에 저장 목록은 echo
문 누락 한 생각, 당신은팝업 모달 창에서 sql 결과를 표시 할 수 없습니다.
if (isset($_GET['idi'])) {
$pop_id = $_GET['idi'];
$popList="";
$sql = mysql_query("SELECT * FROM products WHERE id='$pop_id' LIMIT 1");
if($sql === false) {
var_dump(mysql_error());
}
else {
print_r(mysql_num_rows($sql));
}
$popCount = mysql_num_rows($sql); // count the output amount
if ($popCount == 1) {
while($row = mysql_fetch_array($sql)){
$exp = $row["expiry"];
$com = $row["comments"];
$term = $row["terms"];
$qid = $row["id"];
$pname = $row["product_name"];
$rs = $row["price"];
$detail = $row ["details"];
$popList .= '<a href="#x" class="overlay" id="tc_form"></a>
<div class="popup">
<h2>Product Offer</h2>
<p></p>
<div>
<label for="pass">Price <?php echo $rs; ?></label>
</div>
<div>
<label for="firstname">Expiry Date</label>
</div>
<div>
<label for="lastname">Details</label>
</div>
<div>
<label for="lastname">Conditions</label>
</div>
<div>
<label for="lastname">Terms & Conditions</label>
</div>
</div>';
}
} else {
echo "That item does not exist.";
exit();
}
내 코드에 echo $ popList를 삽입했습니다. 하지만 팝업되지 않습니다. –