I have the following dates set and query:
create table test (
id int unsigned not null auto_increment primary key,
street1 varchar(32) not null default '',
street2 varchar(32) not null default '',
city varchar(32) not null default '',
state varchar(32) not null default '',
code varchar(32) not null default '',
country varchar(32) not null default ''
);
insert into test (street1, street2, city, state, code, country)
values ('44 Abc St', '', 'NYC', 'New York', '10016', 'United States');
select
concat_ws('\n', NULLIF(street1, ''), NULLIF(street2, ''),
NULLIF(city, ''), NULLIF(state, ''),
NULLIF(code, ''), NULLIF(country, '')) o_address
from test
http://sqlfiddle.com/#!9/b919c4/3/0
But somehow PHP is interpreting this string with extra white spaces like below: I'am sure it's during the fetch, because tested on few MySQL IDE's and the query works fine.
44 Abc St
NYC
New York
10016
United States