How can I output my MySQL data into following structures?
Posted
by sky
on Stack Overflow
See other posts from Stack Overflow
or by sky
Published on 2010-04-20T05:57:03Z
Indexed on
2010/04/20
6:03 UTC
Read the original article
Hit count: 202
Here is the question, how can I output MySQL data into format like :
userAge, userMid are the column name, table name Users.
<script type="text/javascript">
userAge = new Array('21','36','20'),
userMid = new Array('liuple','anhu','jacksen');
</script>
Which I'll be using later with following code :
var html = '
<table class="map-overlay">
<tr>
<td class="user">' +
'<a class="username" href="/' + **userMid[index]** + '" target="_blank"><img alt="" src="' +
getAvatar(signImgList[index], '72x72') +
'"></a><br>
<a class="username" href="/' + **userMid[index]** + '" target="_blank">' +
userNameList[index] +
'</a><br>
<span class="info">' + **userSex[index]** + ' ' + **userAge[index]** + '?<br>
' +
cityList[index] +
'</span>' +
'</td>
<td class="content">' + picString
+ somethings[index] + '<br>
<span class="time">' +
timeList[index] + picTips +
'</span></td>
</tr>
</table>
';
PS: I Just been told that i coulnt use JSON to output that format, so i have no idea now >.<
Thanks!
© Stack Overflow or respective owner