/    Sign up×
Community /Pin to ProfileBookmark

Results go to multiple lines   help?

Hi I am outputting results to table.

However, say i have a title being outputted from my database…

ie “ABC Medical Center”
It displays on three lines ie
ABC
Medical
Center

I want it on one line.. to i need to insert   between the words? how would i do that? would i need to explode it? and enter those? is there a shortcut?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@hdoggauthorMay 18.2007 — Exploding it was the right approach, here's what i did...


[code=php]if(isset($res['JOBNAME']))
{
$jobname = $res['JOBNAME'];
$pieces = explode(" ", $jobname);
$number = count($pieces);
$combined = "";
$space = " ";
for($i = 0; $i < $number; $i++)
{
$combined = $combined.$space.$pieces[$i];
}[/code]
Copy linkTweet thisAlerts:
@CharlesMay 18.2007 — is there a shortcut?[/QUOTE][code=php]echo str_replace (' ', '&nbsp;', 'ABC Medical Center');[/code]
Copy linkTweet thisAlerts:
@hdoggauthorMay 18.2007 — Charles -

That's awesome!!! Simple yet powerful...

Cheers-

Hyrum
Copy linkTweet thisAlerts:
@CharlesMay 18.2007 — Whenever you find yourself saying to yourself, "There must be a better way!", check the documentation. It's likely that there is.
×

Success!

Help @hdogg spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...