0

我有一个 CSS 模式窗口。我想显示 sql 结果。当我点击一个链接。单击链接后,它从中获取 id<a href="index.php?idi='.$id.'">并从数据库中选择数据并显示在弹出窗口中,这是我放置代码以在弹出窗口中查看的位置index.php。但这不起作用,我需要知道缺少什么或必须添加什么,谢谢

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();
}
4

1 回答 1

1

试试这个,我认为你错过了echo保存在$popList变量中的列表语句。将以下代码添加到代码底部

echo $popList;
于 2013-03-12T05:37:43.740 回答