This is a continuation of an earlier question that was started here:
Pull Apart Date Range into Separate Cells in CSV, Excel or Spreadsheet
After consulting with a couple of developers, I decided to turn this into a PHP/MySql solution, instead of a Excel VBA solution. Here is the problem. I am a complete newbie with PHP. I can code html and css, (which is why I strayed from the Excel/VBA solution), but I start to go a bit cross-eyed after reading too much PHP. I am hoping you can help.
Here is the issue at hand:
I have a table with car parts. Each car part fits a year range. For each part, I need a listing (row) for each year in the range. For example, a muffler for a Ford Mustang might fit years 1972 to 1977. In the table, currently this is all one row of data. I need one row of data for each year in the range that the muffler fits. For this example, the table would go from one row to six, each row containing the year that the part fits the model.
I've been told to "write a loop" do carry this out for me. I have tried. I have pulled hair. Done more research on PHP.net and tried again. If you can help me go in the right direction with this problem it would be greatly appreciated!
Here is the code that created the table:
`enter code here`
<?php
$result = mysqli_query($con,"SELECT * FROM xxxxxxxxxxxx");
echo "<table border='1'>
<tr>
<th>ItemNo</th>
<th>Description</th>
<th>Model</th>
<th>YearBeg</th>
<th>YearEnd</th>
<th>YearRangeCount</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['ItemNumber'] . "</td>";
echo "<td>" . $row['Description'] . "</td>";
echo "<td>" . $row['Model'] . "</td>";
echo "<td>" . $row['YearBeg'] . "</td>";
echo "<td>" . $row['YearEnd'] . "</td>";
echo "<td>" . $row['YearRange'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>