dimanche 13 décembre 2015

How To fetch single Record from Database & display it using my sqli

hi I am beginner in Php programming , I want to fetch a single record from database against a specific card number . I passed the card number from previous page through form like this:

<input type="number" class="form-control" name="card" placeholder="Enter Valid Card Number>

and now i want to display a paticular record against that card number from db like this: `

/* fetch associative array */
while ($row = mysqli_fetch_row($result)) {
?>
<div class="container"> <!-- 1 -->
<div class="table table-hover">  <!-- 2 -->
<table class="table">
<thead>
<tr>
<th> ID</th>
<th> Name</th>
<th>Phone</th>
<th>Card No</th>
<th>Valid From</th>
<th>Valid to</th>
<th>Discount</th>
<th>Address</th>
</tr>
</thead>
<tbody>
 <tr>
 <td>  <?php echo $a;//print("$row[0]") ?>
</td>
<td><?php print("$row[1]") ?></td>
<td><?php print("$row[2]") ?></td>
<td><?php print("$row[3]") ?></td>
<td><?php print("$row[4]") ?></td>
<td><?php print("$row[5]") ?></td>
<td><?php print("$row[6]") ?></td>
<td><?php print("$row[7]") ?></td>
</tr>
<?php}
mysqli_free_result($result);
mysqli_close($conn);
}
else {
header("location:membership.php?msg=Invalid Card Number");
}?>

</tbody>
</table>
</table>`

this code is not wroking it is not fetching the record

Aucun commentaire:

Enregistrer un commentaire