title: Display SQL query results
body: <p>I am having trouble displaying results from a SQL query. I am trying to display all images and prices from a products table. </p>
  
  <p>I am able to display the echo statement "Query works" in the browser. But, the results are not displaying in the browser.</p>
  
  <pre><code>        if ($count &gt; 0) {
              echo "Query works";
          } else {
              echo "Query doesn't work" ."&lt;br/&gt;";
          }
  </code></pre>
  
  <p><strong>PHP Code:</strong></p>
  
  <pre><code>$con = getConnection();
          $sqlQuery = "SELECT * from Products";
  
          // Execute Query -----------------------------           
          $result = mysqli_query($con, $sqlQuery);
              if(!$result) {
                  echo "Cannot do query" . "&lt;br/&gt;";
                  exit;
              }
  
              $row = mysqli_fetch_row($result);
              $count = $row[0];
  
              if ($count &gt; 0) {
                  echo "Query works";
              } else {
                  echo "Query doesn't work" ."&lt;br/&gt;";
              }
  
            // Display Results -----------------------------
  
              $num_results = $result-&gt;numRows();
  
              for ($i=0; $i&lt;$num_results; $i++) {
                  $row = $result-&gt;fetchRow(MDB2_FETCH_ASSOC);
                  echo '&lt;img src="'.$row['Image'].'&gt;';
                  echo "&lt;br/&gt;" . "Price: " . stripslashes($row['Price']);
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Screenshot 1</strong><br>
  <img src="https://i.stack.imgur.com/3qbi6.png" alt="alt text">
  <strong>Screenshot 2: removed the images from the database, and used a filepath instead</strong></p>
  
  <p><img src="https://i.stack.imgur.com/gyoYf.png" alt="alt text">
  <strong>Screenshot 3: print_r($row)</strong></p>
  
  <p><img src="https://i.stack.imgur.com/JvFrx.png" alt="alt text"></p>