PHP PDO中fetch的问题
<?php$pdo=newPDO("mysql:host=localhost;dbname=test","root","");$rs=$pdo->query("selec...
<?php
$pdo=new PDO("mysql:host=localhost;dbname=test","root","");
$rs=$pdo->query("select * from message");
$array=$rs->fetchall();
print_r($rs);
?>
输出结果是:
Array ( [0] => Array ( [id] => 1 [0] => 1 [user] => f [1] => f [title] => f [2] => f [content] => s [3] => s [lastdate] => 0000-00-00 [4] => 0000-00-00 )
请问各位我不想看到结果的索引,只想看到id,user,title等字段的值应该怎样实现呢? 展开
$pdo=new PDO("mysql:host=localhost;dbname=test","root","");
$rs=$pdo->query("select * from message");
$array=$rs->fetchall();
print_r($rs);
?>
输出结果是:
Array ( [0] => Array ( [id] => 1 [0] => 1 [user] => f [1] => f [title] => f [2] => f [content] => s [3] => s [lastdate] => 0000-00-00 [4] => 0000-00-00 )
请问各位我不想看到结果的索引,只想看到id,user,title等字段的值应该怎样实现呢? 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询