Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server with default setting (user 'root' with no password) */
- $link = mysqli_connect("localhost", "root", "codebrew", "collegeHub");
- // Check connection
- if($link === false){
- die("ERROR: Could not connect. " . mysqli_connect_error());
- }
- // Attempt select query execution
- $sql = "SELECT * FROM questions";
- if($result = mysqli_query($link, $sql)){
- if(mysqli_num_rows($result) > 0){
- while($row = mysqli_fetch_array($result)){
- echo "<tr>";
- echo "<td>" . $row['id'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- // Free result set
- mysqli_free_result($result);
- } else{
- echo "No records matching your query were found.";
- }
- } else{
- echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
- }
- // Close connection
- mysqli_close($link);
Add Comment
Please, Sign In to add comment