Execute($sql); $tmp = ''; while(!$rs->EOF){ if($tmp != $r" />
麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
PHP生成三维数组的问题[路过帮忙顶一下]
悬赏分:20 - 2007年08月22日

[php]
$sql = "SELECT NClassID,NClass,Abcd FROM " . TABLE_PREFIX . "nclass WHERE SClassID='$SClassID' ORDER BY Abcd";
$rs = &$db->Execute($sql);
$tmp = '';
while(!$rs->EOF){
if($tmp != $rs->fields['Abcd']) $tmp = $rs->fields['Abcd'];
$singerlist[$tmp][] = array('NClass' => $rs->fields['NClass'],
'Adcd' => $rs->fields['Abcd'],
'NClassID' => $rs->fields['NClassID']
);
$cachedata = "$"."singerlist[".$tmp."] =". var_export($singerlist[$tmp],true) . ";\n\n";
$rs->MoveNext();
}
$rs->Close();
unset($sql,$rs,$i);
writetocache($cachename,$cachedata);[/php]
这一段是生成[港台]歌手列表的三维数组的代码,
可生成的cache文件中却只有拼音字母“Z”开头的歌手
[php]
<?php
//[tvcd.cn] cache file, DO NOT modify me!
//Created onDec 25, 2006, 4:01

$singerlist[Z] =array (
0 =>
array (
'NClass' => '朱晓琳',
'Adcd' => 'Z',
'NClassID' => '9',
),
1 =>
array (
'NClass' => '周冰倩',
'Adcd' => 'Z',
'NClassID' => '1857',
),
2 =>
array (
'NClass' => '朱哲琴',
'Adcd' => 'Z',
'NClassID' => '7',
),
3 =>
array (
'NClass' => '张蔷',
'Adcd' => 'Z',
'NClassID' => '59',
),
4 =>
array (
'NClass' => '周彦宏',
'Adcd' => 'Z',
'NClassID' => '2015',
),
5 =>
array (
'NClass' => '周敏萱',
'Adcd' => 'Z',
'NClassID' => '1232',
),
6 =>
array (
'NClass' => '祖海',
'Adcd' => 'Z',
'NClassID' => '2',
),
7 =>
array (
'NClass' => '朱明英',
'Adcd' => 'Z',
'NClassID' => '11',
),
8 =>
array (
'NClass' => '朱桦',
'Adcd' => 'Z',
'NClassID' => '12',
),
9 =>
array (
'NClass' => '张也',
'Adcd' => 'Z',
'NClassID' => '48',
),
10 =>
array (
'NClass' => '赵薇',
'Adcd' => 'Z',
'NClassID' => '36',
),
11 =>
array (
'NClass' => '周旋',
'Adcd' => 'Z',
'NClassID' => '18',
),
12 =>
array (
'NClass' => '周艳泓',
'Adcd' => 'Z',
'NClassID' => '17',
),
13 =>
array (
'NClass' => '张浅潜',
'Adcd' => 'Z',
'NClassID' => '60',
),
14 =>
array (
'NClass' => '赵默',
'Adcd' => 'Z',
'NClassID' => '1264',
),
15 =>
array (
'NClass' => '张蝶',
'Adcd' => 'Z',
'NClassID' => '72',
),
16 =>
array (
'NClass' => '朱逢博',
'Adcd' => 'Z',
'NClassID' => '13',
),
17 =>
array (
'NClass' => '周迅',
'Adcd' => 'Z',
'NClassID' => '1665',
),
);

?>
[/php]
其他字母开头的都没生成。看一下是哪个步骤出了问题?

[ 本帖最后由 millken 于 2006-12-25 12:15 PM 编辑 ]

提问者:millken   08-22 12:12
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
89 + 0 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM