/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Displaying Javascript Content in php with comma spacing.

I am trying to get an output from my database to look like this:

[CODE]<script type=”text/javascript”>
initializetabcontent(“maintab”, “6maintab”, “5maintab”, “4maintab”, “3maintab”, “2maintab”)
</script>[/CODE]

Here is my code:

[code=php] //Javascript for Tab Content//
echo “<script type=’text/javascript’>”;
//Initialize every single tab contnet//
echo “initializetabcontent(‘”;

while($onehome = mysql_fetch_array($sql))
{
$onehome[‘PortfolioID’].”maintab’,”;

}
echo “)”;
echo “</script>”;
//End of Javascript//[/code]

Here is what I want it to look like:

[CODE]<script type=”text/javascript”>
initializetabcontent(“maintab”, “6maintab”, “5maintab”, “4maintab”, “3maintab”, “2maintab”)
</script>[/CODE]

I can’t get it working for some reason and I don’t know why. Anyone have any suggestions.

p.s. My while statement seems accurate and all my coding before and after the while statement is correct, I tested it with other results. However, when I introduce Javascript in a scenario like the one above, I get the error. Urgent help!

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@gc40authorApr 01.2007 — Hhaaha, opps, forgot the 'Echo' statement. Stupid me :$
×

Success!

Help @gc40 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.8,
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,
)...