一开始这样写的
$pdo=new PDO("mysql:host=localhost;dbname=t1","root","");
$sth=$pdo->query('select * from blog');
$result = $sth->fetchALL(PDO::FETCH_ASSOC);
foreach($result as $v){
print_r($v);
}
?>
后来人家告诉我这样写 可是这样打印出来的还是和原来一样 那应该怎么改呢
$pdo=new PDO("mysql:host=localhost;dbname=mysql","root","");
$sth=$pdo->query('select * from user');
$result = $sth->fetchALL(PDO::FETCH_ASSOC);
$tmp_ary=array();
foreach($result as $v){
$tmp_ary[]=array_values($v);
}
echo '
';
print_r($tmp_ary);
echo '
';