0

I was successfully understanding this until I got caught up on my displayed graph on my webpage. Attached is a picture of the graph. It seems that all of the data is pushed back by a single space and leaving the ID column totally out of the chart. Is there any recommendations of what I could possibly do?

When I ran the snippet on this site, it portrays a empty box under the last slot. I know this has to lead to my problem. I do understand that my data won't show up on here because it is connected to "connection.php".

The Graph can be found here.

I strongly feel as if this code is creating the problem.

<html>
<?php

// Include connection.php
 include("connection.php");


$sql = "SELECT *
FROM CARS";
$result = mysql_query($sql,$con);
//echo Sresult;
?>

<table border =1>
<tr>
<td> ID </td>
<td> Make </td>
<td> Model </td>
<td> Year </td>
<td> Mileage </td>
<td> First Name </td>
<td> Last Name </td>
<td> Email </td>
</tr>
<?php
 
//whileloop
while($row = mysql_fetch_array($result)){
?>
<tr
  <td>
   <?php echo $row['ID'];?>
  </td>
  <td>
   <?php echo $row['MAKE'];?>
  </td>
  <td>
   <?php echo $row['MODEL'];?>
  </td>
  <td>
   <?php echo $row['YEAR'];?>
  </td>
  <td>
   <?php echo $row['MILE'];?>
  </td>
  <td>
   <?php echo $row['FNAME'];?>
  </td>
  <td>
   <?php echo $row['LNAME'];?>
  </td>
  <td>
   <?php echo $row['EMAIL'];?>
  </td>

 </tr>



<?PHP
}
?>
</table
</html>
0wlex
  • 11
  • 5
  • Yes, `$row['EMAIL']` is not set or `null`. It doesn't display any value because of that, thus empty row. – Nytrix Dec 05 '16 at 18:11
  • Every time you use [the `mysql_`](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) database extension in new code **[a Kitten is strangled somewhere in the world](http://2.bp.blogspot.com/-zCT6jizimfI/UjJ5UTb_BeI/AAAAAAAACgg/AS6XCd6aNdg/s1600/luna_getting_strangled.jpg)** it is deprecated and has been for years and is gone for ever in PHP7. If you are just learning PHP, spend your energies learning the `PDO` or `mysqli` database extensions. [Start here](http://php.net/manual/en/book.pdo.php) – RiggsFolly Dec 05 '16 at 18:12
  • `` i.e. `` which will throw table into disarray – RiggsFolly Dec 05 '16 at 18:14
  • @RiggsFolly Thank you so much, this is my first time learning HTML and PHP. My professor is making us use the extension sadly. Thank you for the link for the PHP manual, I am sure it will help me along the way. – 0wlex Dec 05 '16 at 18:20

0 Answers0