It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                7年前关闭。
            
                    
我知道您可以将行放入数组中,但是我很难将列放入数组中。我还没有代码。我只是想获取自动递增的列“ id”,并将其放入类似数组中。

$array[0] = 1;
$array[1] = 2;
$array[2] = 3;

最佳答案

$result = mysql_query("SELECT id, name FROM mytable");

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
     $array[] = $row[0];
}

关于php - 如何使用php将mysql列放入数组中? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4250965/

10-11 02:53