Andreu | 0b2f843 | 2019-09-18 20:09:59 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | // Define MySQL login variables |
| 3 | $servername = "fdb22.awardspace.net"; |
| 4 | $username = "3155560_users"; |
| 5 | $password = "btechnoro@fox4news.info"; |
| 6 | |
| 7 | // Create connection |
| 8 | $conn = new mysqli($servername, $username, $password, "3155560_users"); |
| 9 | if ($conn->connect_error) die("Connection failed: " . $conn->connect_error); |
| 10 | $conn->set_charset("utf8"); |
| 11 | |
| 12 | // Do the query |
| 13 | $query = "SELECT * FROM users"; |
| 14 | |
| 15 | // Fetch the information of the user |
| 16 | if ($result = $conn->query($query)) { |
| 17 | while ($row = $result->fetch_row()) { |
| 18 | $id = $row[0]; |
| 19 | $nomcomplet = $row[1]; |
| 20 | $curs = $row[2]; |
| 21 | $grau = $row[3]; |
| 22 | $quimata = $row[4]; |
| 23 | |
| 24 | // Echo the options |
| 25 | echo "<option value='".$id."'>".$nomcomplet."</option>\n"; |
| 26 | } |
| 27 | $result->close(); |
| 28 | } else { |
| 29 | die("Wrong query: " . $query); |
| 30 | } |
| 31 | |
| 32 | // Close connection |
| 33 | $conn->close(); |
| 34 | ?> |