&nbsp echo in table if SQL field is blank

Hi Guys,

Wonder if someone could help me.

I am echoing data from a SQL table to my html table using PHP. I need to include an if statement so that &nbsp is entered into the table cell if no record exists in the SQL table.

My code for this is:
[php]

<? if (!empty($rows['Notes'])) echo $rows['Notes']; else echo ' '; ?>

[/php]

This echos the notes in the sql table if they exist. However if nothing is entered a space is not being entered into the cell of my HTML table. If I swap and echo the &nbsp if the Notes is not empty then a space is entered.
So it looks as if the else part of the code is not being considered when the code is running. Can anyone see any reason for this from my code.

Hope someone can help.

Thanks Edd

Sponsor our Newsletter | Privacy Policy | Terms of Service