Forum Moderators: coopster
my code:
$query="SELECT * FROM items WHERE name='john doe';
$result=mysql_query($query);
$row=mysql_fetch_array($result,MYSQL_BOTH);
if($row{$k}!=""){
echo 'I should only be here if $row{$k} not empty';
echo $row{$k};
}
This will sometimes print even when $row{$k} contains nothing. The table value it is returning should be null or empty and therefore shouldnt print anything?
Is it carriage returns or something? When I view the HTML source it will print a new line where the $row{$k} is at.
I am using something like:
$temp=str_replace(" ","",$row2{$k});
The problem is, it will remove all the spaces except 1 space in certain instances. So if I were to echo '--'.$temp.'--'; my output would be something like -- -- .
There should be no possible way for a space to be in there using the str_replace.
$temp=str_replace(" ","",$row2{$k});
if($temp!=""){ echo '<td>'.$row2{$k}.'</td>';}
So I would like to avoid it printing what looks like an empty cell. here is part causing problem from the var_dump:
[12]=> string(1) " "
I really want to remove that character, but I have some strings which will be only 1 character in length that I still do want to display, so forced character remove and strlen do not really work here.
Also, I did try adding characters to the string before removing the white space, but that did not work as well, same end result. I am wondering if it is some weird clear character. How can I check what the character code is in ASCII?