php - Data from database not appearing in table on HTML site -
i have form keys in contacts of guest list. on same page after submit button keyed want retrieve data , display list of guest. data keyed form received in database. not being displayed on screen on html site.
top of invites.html:
<?php include("guestlist.php"); include("guestlist_connect.php"); ?>
invites.html:
<h2 >invites & guest list</h2> <table border="2"> <thead> <tr> <th>first name</th> <th>last name</th> <th>contact</th> <th>invitation</th> </tr> </thead> <tbody> <?php include("guestlist_connect.php"); $result = mysql_query("select * guestlist"); while( $row = mysql_fetch_assoc( $result ) ){ ?> <tr> <td><? php echo $row["fname"]; ?></td> <td><? php echo $row["lname"]; ?></td> <td><? php echo $row["email"]; ?></td> <td><? php echo $row["contact"]; ?></td> </tr> <?php </tbody> </table> <?php mysql_close($connector); ?> </div><!--end rightcontainer--> </div>
_guestlist_connect.php:_
<?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "registration"; $conn = mysqli_connect($servername, $username, $password, $dbname) or die("connection failed: " . mysqli_connect_error()); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } ?>
first, not need repeat include("guestlist_connect.php"); , forgot end while loop
<?php include("guestlist.php"); include("guestlist_connect.php"); ?> /*invites.html*/ <h2 >invites & guest list</h2> <table border="2"> <thead> <tr> <th>first name</th> <th>last name</th> <th>contact</th> <th>invitation</th> </tr> </thead> <tbody> <?php $result = mysql_query("select * guestlist"); while( $row = mysql_fetch_assoc( $result ) ){ ?> <tr> <td><? php echo $row["fname"]; ?></td> <td><? php echo $row["lname"]; ?></td> <td><? php echo $row["email"]; ?></td> <td><? php echo $row["contact"]; ?></td> </tr> <?php } ?> // forgot end while loop </tbody> </table> <?php mysql_close($connector); ?> </div><!--end rightcontainer--> </div>
Comments
Post a Comment