当我尝试从特定列下的某个表中查询某些内容时,回显结果显示两个值,一个键值为0,另一个值为该列的键名称。为什么PHP foreach显示查询两次?
我的代码是这样的:
$查询= “选择nepal_posts ID”; $ queryExe = mysql_query($ query,$ connection);
while ($fetched = mysql_fetch_array($queryExe)) {
foreach ($fetched as $key => $value) {
echo $key."----->".$value." ";
}
}
和结果是这样的:
0 -----> 9 ID -----> 9 0 - - - - > 10 - - - - 编号> 10
为什么有两次重复?
我该如何编码才能获得正确的结果?
我的数据库表是这样的:
ID - > 9,10题 - >关于我们/嗡奥斯,我们的服务/ VA¥[R Verksamhet 后 - > BLA BLA,BLA BLA
因为mysql_fetch_array默认情况下取得的数值和关联格式 – 2012-04-26 01:35:10
没有人读手册了您的数据:( – Phil 2012-04-26 01:35:33
@Phil#1是新的搜索界面,使用手册,就像谷歌是“德intarwebs” (或Facebook,取决于你的年龄) – deceze 2012-04-26 01:37:08