lundi 28 septembre 2015

Dont know what is wrong with this code. It doesnt work

Hi can anyone tell me why this code doesnt work? i was following tutorial from

https://www.youtube.com/watch?v=m4X4c4fRW2Q unfortunately for me i cant seems to do as what he is doing. i only followed his tutorial till 17min. i adjusted some of his code but still are not able to produce what he produced at the 17min mark of the video.

Here is my code..

<?php

$connection = mysqli_connect("localhost", "root", "");
if (!$connection) {
    die("Database connection failed: " . mysqli_error());
}
$queryDate = mysqli_select_db($connection, "car_request");
if (!$queryDate) {
    die("Database selection failed: " . mysqli_error());
}
?>






<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
  <title>Our Company</title>
  <style type="text/css">
   body{
      font-family:Arial, sans-serif;
      font-size:14px;
      line-height: 1.6x;
      test-align:center ;
      }
      #wrapper{
          margin:0 auto;
          width:650px;
          text-align:left;
      }
      td{
          padding: 20px
      }
      thead{
          background: #D2E6EA;
      }
      </style>
</head>

<body>


 <div id="wrapper">

  <form action ="<?php echo $_SERVER['PHP_SELF']; ?>"method="GET">
  <table width="100%">
  <thead>
      <tr>
      <td>Police ID</td>
      <td>Role</td>
      <td>Name of Supervisor</td>
      <td>Date</td>
      <td>Time</td>
      <td>Type of vehicle</td>
      <td>Reasons</td>
      <td>&nbsp</td>
      </tr>
  </thead>
  <tbody>
  <?php while($row = $queryDate->fetch_assoc()){
  <tr>
      <td>echo $row['police_id']</td>
      <td> echo $row['role']</td>
      <td> echo $row['supervisor_name']</td>
      <td> echo $row['date']</td>
      <td> echo $row['time']</td>
      <td> echo $row['vehicle_type']</td>
      <td> echo $row['reasons']</td>
      <td>
      <input type="checkbox" name="multiple[]" value=" echo $row['id'];">
      </tr>
  }
  ?>

  </tbody>
  </table>
  </form>



  </div>
  </body>
  </html>

and i would like to ask why is he able open up php in the html so many times. If anyone gets what i saying...

Cheers look forward for anyone who reply... :)




Aucun commentaire:

Enregistrer un commentaire