I am trying to use the function mysqli_fetch_field()
to get the name of each of my tables in the database. However when i try to output the table name using $fieldInfo->table
i get duplicates. How can i select only 1 column from each table so that $fieldInfo->table
isnt called for every column of each table?
current sql:
$sql = "SELECT * from administrators, bookings, customers, rooms";
$results = mysqli_query($conn, $sql)
or die ('Problem with query' . mysqli_error($conn));
my code to display the table name in radio buttons:
<?php
while ($fieldInfo = mysqli_fetch_field($results)) {
?>
<input type="radio" name="tableNames" value="<?php echo $fieldInfo->table; ?>"> <?php echo $fieldInfo->table ?> <br>
<?php } ?>