mysqli array_values重复每个列值

时间:2017-05-01 19:55:13

标签: php mysqli

// get the table records
    $query = "SELECT * FROM mytable ORDER BY field1 ASC, field2 ASC ";
    $result = mysqli_query($link,$query)
         or die('error making Members query - ' . mysqli_error($link));
// This part works perfectly 
    $headers = mysqli_fetch_fields($result);
    foreach($headers as $header) {
        $head[] = $header->name;
    }
//This fails
    while ($row = mysqli_fetch_array($result)) {
        $zz = array_values($row);
        print_R($zz); 
// for this test I only want to look at the first row, so exit
        exit;    
    }

我得到: 阵列([0] => 1179 [1] => 1179 [2] => 1549 [3] => 1549 [4] => 1 [5] => 1 [6] => OWN [7] => OWN [8] => 2017-05-31 [9] => 2017-05-31 ...

并且每行的每一列都是重复的。 我用这张桌子做的每一件事似乎都有用。

0 个答案:

没有答案