Hi all, i have m y search setup which brings back a part number, a description and then underneath any associated manufacturers name and part number which could range from 1 to 20, my problem is i just want to populate my table if there is something there and if there isnt then dont show it.

lets say if i search 1212 it would give me
part number 1212
description = various models
volvo = 3434
vw = 5656
opel = ?

i want to hide the empty row becuase there isnt anything there
hope this is clear i tried my best to explain


8 Years
Discussion Span
Last Post by liamfriel
<?php if($mydata>0)  { ?>
<tr style='display:inline'>
<td> this is visible</td>

<tr style='display:none'>
<td> invisible</td>


Edited by urtrivedi: n/a


thanks for that, it works perfectly, although i cant help think that maybe i need to restructure my database becuase i have all the different manufacturs in there own colum and so the code you gave me has to run for each column and there are around 120, and although it will work great i want to do it properly so thanks for you help im going to go away now and try to redo the database


The structure is fine - you just need to run a better query. Lookup how to do Joins or querying multiple tables.


$query = "SELECT `p`.`partnumber`, `p`.`description`, `m`.`manufacturer` FROM `parts` `p`, `manufacturers` `m` WHERE `p`.`manufacturer_id` = `m`.`manufacturer_id`"

This will set a condition to get both the parts information and get the manufacturer name where the id's are linked.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.