title: Migrading from PHP4 TO PHP5
body: <p>The code you see is from an app that generates a a drop-down list. You select from the drop down list and it generates a report. I am migrating this app from an old version of php to  the latest, but I cant get the list to generate on the form. Can anyone tell me what I am doing wrong or what needs to change. I am not a PHP developer, I am learning, but I am not there yet.</p>
  
  <pre><code>function getcourses(){
  $query = "SELECT DISTINCT * FROM courses"; 
  
  
  
  $result = mysqli_query($dbc,$query); 
  while($row = mysql_fetch_array($result)){
  
  $course_id = $row['course_id'];
  $course_no = $row['course_no'];
  $course_name = $row['course_name'];
  $start_month = $row['start_month'];
  $start_day = $row['start_day'];
  $start_year = $row['start_year'];
  $end_month = $row['end_month'];
  $end_day = $row['end_day'];
  $end_year = $row['end_year'];
  
  $course_date = $start_month . " " .  $start_day . ", " . $start_year . " - " . $end_month . " " .  $end_day . ", " . $end_year;
  
  echo '&lt;option value="' . $course_id . '~' . $course_date . '"&gt;' . $course_name . ', ' .  $course_date . '&lt;/option&gt;';
  }
  }
  
  ?&gt;
  &lt;p&gt;Please select the course roster you would like to download from the list below&lt;/p&gt;
  &lt;form action="download_excel.php" name="reportrequest" method="POST"&gt;
  &lt;select name="course_report"&gt;
  &lt;?php getcourses() ?&gt;
  &lt;/select&gt;
  &lt;input class="btn btn-primary" type="submit" name="submit" id="submit" value="Retrieve Report" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <hr>
  
  <p>So here is what the new code looks like, I still keep getting this error:
  PHP Warning:  mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in</p>
  
  <p>this happens on thi line: while($row = mysqli_fetch_array($result))</p>
  
  <pre><code>function connect(){
  $dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD);
  return $dbc;
  }
  
  function getcourses(){
  $query = "SELECT FROM courses";  
  $result = mysqli_query(connect(),$query); 
  
  while($row = mysqli_fetch_array($result)){
  
  $course_id = $row['course_id'];
  $course_no = $row['course_no'];
  $course_name = $row['course_name'];
  $start_month = $row['start_month'];
  $start_day = $row['start_day'];
  $start_year = $row['start_year'];
  $end_month = $row['end_month'];
  $end_day = $row['end_day'];
  $end_year = $row['end_year'];
  
  $course_date = $start_month . " " .  $start_day . ", " . $start_year . " - " . $end_month . " " .  $end_day . ", " . $end_year;
  
  echo '&lt;option value="' . $course_id . '~' . $course_date . '"&gt;' . $course_name . ', ' . $course_date . '&lt;/option&gt;';
  }
  
  }
  </code></pre>