close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How can I hide columns shown as empty fields?

Thread began 2/10/2018 3:12 am by anonymous | Last modified 2/12/2018 10:51 am by anonymous | 194 views | 1 replies


How can I hide columns shown as empty fields?

Hi, I am trying to display baby names for boys and girls in a table format. I have had to display them in terms of gender, so below is what i have at the moment which works however, when i select a letter, it displays both boysnames and girlsnames and then also adds loads of extra empty columns

see code below:
echo "<div class='bigMargin'>";
if (isset($_GET["initial"])) {
$dbQuery=$conn->prepare("select * from babynames where babyNames like :initial");

$arr = array();
$count = 0;
while($dbRow = $dbQuery->fetch(PDO::FETCH_ASSOC)) {
if($dbRow['gender'] === 'B') { $arr['BoysName'][] = $dbRow['babyNames']; }
elseif($dbRow['gender'] === 'G') { $arr['GirlsName'][] = $dbRow['babyNames']; }

echo '<center>
<table border="1" width="400">
<th>Boy Names</th>
<th>Girls Names</th>

$i = 0;
while($i < $count) {
echo '<tr>';
if(isset($arr['BoysName'][$i])) { echo '<td>'.$arr['BoysName'][$i].'</td>'; }else{ echo '<td>&nbsp;</td>'; }
if(isset($arr['GirlsName'][$i])) { echo '<td>'.$arr['GirlsName'][$i].'</td>'; }else{ echo '<td>&nbsp;</td>'; }
echo '</tr>';

Can someone please help?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...