/    Sign up×
Community /Pin to ProfileBookmark

Array problem

I am trying to fill arrays to use in my javascript codes as following

[code=php]
var codes = new Array (
<?php $sql1 = mysql_query(“SELECT * FROM produse order by cod ASC”) or die(mysql_error());

while($row1 = mysql_fetch_array($sql1))
{
echo ”’.$row1[“cod”].”,’;
}
?>’murat_’)

var clients = new Array (
<?php $sql2 = mysql_query(“SELECT * FROM magazalar order by shop_name ASC”) or die(mysql_error());

while($row2 = mysql_fetch_array($sql2))
{
echo ”’.$row2[“shop_name”].”,’;
}
?>’murat’)[/code]

This process doesnt return any results
But when i erase one of the arrays above, the other one works perfectly or in the second array when i intentionally change the part like

[code=php]while($row = mysql_fetch_array($sql2))[/code]

here i am intentionally write false code ($row instead of $row2)

Then i get the list for the 1st one as it is supposed to be

So what can be the error i am making here?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@cgishackFeb 04.2008 — whats the Javascript output look like?

It would be much easier to debug if we could see how it is rendering on the page.
×

Success!

Help @mrtblt 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...