Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <?php
- //=======================================================================
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "courses";
- //========================================================================
- //========================================================================
- $conn = new mysqli($servername, $username, $password, $dbname);
- //========================================================================
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- //========================================================================
- $sql = "SELECT id, countries FROM countries";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<select>";
- echo "<option value= ".$row["id"]."> ". $row["countries"]." </option>";
- echo "</select>";
- }
- } else {
- echo "0 results";
- }
- //=============================================================================
- $sql1 = "SELECT universities FROM universities where id = ' ".$row["id"]." '";
- $result1 = $conn->query($sql1);
- if ($result1->num_rows > 0) {
- while($row1 = $result1 -> fetch_assoc()) {
- echo "<select>";
- echo "<option value= > ". $row1["universities"]." </option>";
- echo "</select>";
- }
- }
- //======================================================================================
- $conn->close();
- //=======================================================================================
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement