无法在弹出模式窗口中显示sql结果

时间:2013-03-12 05:31:23

标签: php javascript css3 popup modalpopupextender

我有一个css模态窗口。我想显示sql结果。当我点击链接时。单击链接后,它从<a href="index.php?idi='.$id.'">获取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();
}

1 个答案:

答案 0 :(得分:1)

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

echo $popList;