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

regards
dan

<?php if($mydata>0)  { ?>
<tr style='display:inline'>
<td> this is visible</td>
</tr>

<?php
}
else
{
?>
<tr style='display:none'>
<td> invisible</td>
</tr>

<?php
}
?>

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.

example

$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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.