简体   繁体   中英

Prepared statement to select data in php

I am trying to select data from database without condition . How to display the name of records from database ? So far , I tried this !

<div class="well"><form method="post" >
     <div class="form-check">
    <?php
    $con = new mysqli('localhost','root','','icac_database');
    $seq = 'SELECT adr_name,adr_id FROM `adr` ';
    $stmt = $con->prepare($seq);
    //$stmt->bind_param('ss',$adr_name,$adr_id);
    $stmt->execute();
    $stmt->store_result();
    $stmt->bind_result($adr_name,$adr_id);
    while($stmt->fetch() ) { 
    ?>
    <input type="checkbox" name="type" class="form-check-input" id="type">
    <label class="form-check-label" for="contin"><?php $adr_name; ?> </label>   

    <?php  }?>
    </div>
    </form>
    <input type="submit" name="choose" value="submit"/>
    </div>

您缺少echo您的变量:

<?php echo $adr_name; ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM