title: using mysqli to fetch data
body: <p>i've been trying my hand at mysqli. </p>
  
  <p>using procedural mysql, the code displays the results fine. however, after making the switch to OOP mysqli, i tried converting the code to mysqli, and it says there are no quotes.
  is there anything wrong with the code?</p>
  
  <pre><code>/* the database object */
          private $_db;
  
          public function __construct($db=NULL)
          {
              if(is_object($db))
              {
                  $this-&gt;_db = $db;
              }
              else
              {
  
                  $this-&gt;_db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
              }
          }
  
          public function displayQuotes()
          {
              $sql = "SELECT cQuotes, vAuthor, cArabic, vReference 
                            FROM thquotes 
                            ORDER BY RAND()
                            LIMIT 1;";
  
                    try {
  
                        $query = $this-&gt;_db-&gt;prepare($sql);
                        $query-&gt;execute();
                        $query-&gt;store_result();
  
                        /* bind variables to prepared statement */
                        $query-&gt;bind_result($cQuotes, $vAuthor, $cArabic, $vReference);
  
  
                        if(!$query-&gt;num_rows==0)
                        {
                          while($row = $query-&gt;fetch())
                          {
                              //echo $this-&gt;formatQuotes($row);
                              $formatHTML = new formatHTML();
                              echo $formatHTML-&gt;formatQuotes($row);
                          }
  
  
                        }
                        else
                           {
                              echo "There are no Quotes!";
                           }
                         $query-&gt;free_result();
                        $query-&gt;close();
                      }
                    catch (Exception $ex){
  
                          echo "Something went wrong " . $ex;
                      }
  
          }
  </code></pre>