I have a table on a MySQL database called quotes. This table contains a column called quote_id, I use a select query to retrieve an array where the quote_id matches the id of the quote being edited.
"SELECT * FROM quotes WHERE quote_id = '$quote_id'";
The remaining columns in the table contain the various products labeled by their product code.
The other table called items contain each product with its product code as model, description and price.
Each time a new quote is created it is inserted into the table with a unique quote ID. The value below each column is the quantity required for the quote.
What I am trying to achieve is using a query to retrieve a specific row from the database, and only display the value greater than 0.
As you can see I am able to achieve this but the table rows that are not showing affect the spacing between rows.
The if statement I used for each table row is as follows:
<tr>
<td>
<?php if ($kx_t7765x >0 ){ echo "KX-T7765";} ?>
</td>
<td>
<?php if ($kx_t7765x >0 ){ echo "Doorphone";} ?>
</td>
<td>
<?php if ($kx_t7765x >0 ){ echo $kx_t7765x;} ?>
</td>
</tr>
I am sure there must be an easier way to go about doing this instead of coding this for each and every table row required, and Im sure using a while statement would be the correct way to go about this.