title: Display results from mysql query in php
body: <p>I am trying to develop an upcoming course dates for my website. I want to maintain the data in an mysql database. I have set up 3 table in msql.</p>
  
  <p>1.courses</p>
  
  <p>2.category</p>
  
  <p>3.coursedates</p>
  
  <p>All are linked by course_id. </p>
  
  <p>Basically I want to present the data from coursedates in the following way in PHP using a query. </p>
  
  <p><p>Course Title     &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;No Of Days    &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;Course Date</P></p>
  
  <p>I have tried using the follwoing coding </p>
  
  <pre><code>&lt;?php
  $con=mysqli_connect("localhost","root","","mentertraining");
  // Check connection
  if (mysqli_connect_errno())
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  
  
  $query = "SELECT `coursedates`.`coursedate_id`,`courses`.`course_title`,`courses`.`no_of_days`,`category`.`category_name`,`coursedates`.`date1` FROM coursedates\n"
      . "LEFT JOIN `mentertraining`.`courses` ON `coursedates`.`course_id` = `courses`.`course_id` \n"
      . "LEFT JOIN `mentertraining`.`category` ON `courses`.`category_id` = `category`.`category_id` LIMIT 0, 30 ";
  
  $result = mysql_query($query);
      echo "&lt;table border='1'&gt;
  &lt;tr&gt;
  &lt;th&gt;Course Title&lt;/th&gt;
  &lt;th&gt;Course Date&lt;/th&gt;
  
  &lt;/tr&gt;";
  
  while($row    = mysql_fetch_assoc($result))
    {
    echo "&lt;tr&gt;";
    echo "&lt;td&gt;" . $row['course_title'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['date1'] . "&lt;/td&gt;";
    echo "&lt;/tr&gt;";
    }
  echo "&lt;/table&gt;";
  
  mysqli_close($con);
  ?&gt; 
  </code></pre>