title: Simplify and speed up process for querying database for every day of month
body: <p>I have a feeling that this isn't the most effective way to go about obtaining and displaying this information, but I can't seem to find an answer anywhere that directly applies to what I'm doing. I need to query the database for each day of the month and display that information. I need to display every day in the month even if there is no data. </p>
  
  <p>The only way I know how to do this is to query the database for every day. I know querying the database too often slows down the page load time. Should I get the data for the entire month and search through the array instead?</p>
  
  <p>The basic idea of what I am doing:</p>
  
  <pre><code>// DATES OF MONTH ARE IN AN ARRAY CALLED $dates
  foreach($dates as $key =&gt; $date){
      $getdata = mysqli_query($link, "SELECT * FROM `Data` WHERE section = $section AND type = $typeid AND `date` = $datecomp");
      $info = mysqli_fetch_assoc($getcatdata);
      if(isset($info)){
          // Display info
      }
      else {
          // Display empty div
      }
  }
  </code></pre>