Mysql and php w/ html database issue -
i want data sql database table html.
i have writed 1st part of code ended ?>
and started html table , end html
my code getting empty table without getting data database, here code, dont know how data
<td> <?php echo $result['nazwiskoimie'] ?> </td>
here's full code :
<?php $con=mysqli_connect("localhost","root","","listap"); if (mysqli_connect_errno()) { echo "blad przy polaczeniu z baza: " . mysqli_connect_error(); } $result = mysqli_query($con,"select * 'lista'"); ?> <html> <table border='1'> <tr> </tr> <tr> <td> <?php echo $result['nazwiskoimie'] ?> </td> //in part have problem data database </html>
here's screenshot of result: final after save file
please try this:
$result = mysqli_query($con,"select * lista");; ?> <html> <table border='1'> <?php if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { ?> <tr> <td><?php echo $row['nazwiskoimie']?></td> </tr> <?php } } ?> </table> </html>
Comments
Post a Comment