Reputation: 431
<?php
include 'ASEngine/AS.php';
if(!$login->isLoggedIn())
header("Location: login.php");
$user = new ASUser(ASSession::get("user_id"));
$userInfo = $user->getInfo();
//basic include files
require_once("../db.php");
$nav = 'hotels';
$hotel_id = '1';
//Messages
include 'inc/messages.php';
$sql1 = mysqli_query($conn,"SELECT room_type_name FROM hotel_room_type WHERE hotel_id = '$hotel_id'");
?>
HTML code:
<div class="form-row row-fluid">
<div class="span12">
<div class="row-fluid">
<label class="form-label span3">Room Name</label>
<?php echo "<select>";
echo "<option value=''>Select One</option>";
$results = $conn->query($sqll);
foreach ($results as $data) {
echo "<option>$data[room_type_name]</option>";
}
echo "</select>";
?>
</div>
</div>
</div>
I am getting values from a table from a database and the values should be displayed inside a dropdown list. I have used the above code but it is not displaying anything. Can anyone help in this issue?
Upvotes: 2
Views: 1276
Reputation: 3925
You have a typo
$results = $conn->query($sqll);
should be
$results = $conn->query($sql1);
it is a one, not an L
Upvotes: 5