Database Functionality Testing

Let's now write a test code that you can run on your end to make sure that everything is connected correctly.

First, make sure you have a database mydb, and in it, a table users, filled with some data.

Then run the following code:

php<?php
  $host = 'localhost'; // hostname
  $user = 'root';      // username
  $pass = '';          // password
  $name = 'mydb';      // database name
  
  $link = mysqli_connect($host, $user, $pass, $name);
  
  $query = 'SELECT * FROM users';
  $res = mysqli_query($link, $query) or die(mysqli_error($link));
  var_dump($res);
?>

If there are no errors on the screen and you see the result of var_dump - then everything is fine. If there are any errors - fix them and try again.

Задание 1

Copy and run the provided test code on your end.