title: how do I check if mysqli connection is working?
body: <p>I am really new on php and I am trying to create my own php shop cart. After some research I got myself stuck in the "function products" below because seems to me it is not working properly. I expect to see the names of my products on my mysql database but it is not showing anything. My user name is noivaemd_etalhes, I am using my correct password and my database name is noivaemd_cart and I created on this database the table called Products with my list of products available. Can anybody help me to figure out what am I doing wrong on the php instructions below???? I appreciate any help.</p>
  
  <pre><code>&lt;?php 
  
  session_start();
  $page = 'index.php';
  
  function products()  {
          $con = mysqli_connect("localhost", "noivaemd_etalhes", "mypassword", "noivaemd_cart") or die (mysqli_error());
          $res = mysqli_query($con, "SELECT id, name, description, price FROM Products WHERE quantity &gt; 0 ORDER BY id DESC");
          if (mysqli_num_rows($res)==0) {
          echo "&lt;font family=verdana&gt;&lt;font size=6px&gt;&lt;font color= #90882C&gt;&lt;font style=normal&gt;&lt;font variant= normal&gt;&lt;br&gt;No products available&lt;br&gt;&lt;/font&gt;";
              }
          else{
          while($get_row = mysqli_fetch_assoc($res)) {
                  echo '&lt;p&gt;'.$res['name'].'&lt;/p&gt;';
          }
      }
  }
  
  ?&gt;
  </code></pre>