我试图显示一个表名列表,该列表使用下面的代码,但我希望它跳过第一列(ID号)。如何实现这一目标?
$forms_colums = array();
$get_table_colums = mysqli_query($capital_db, "SHOW COLUMNS FROM tbl_customers ");
while ($found_table_colums = mysqli_fetch_array($get_table_colums)) {
$forms_colums[] = $found_table_colums['Field'];
}
答案 0 :(得分:2)
您可以在末尾添加array_shift($forms_columns)
,从而删除数组中的第一个元素:
$forms_colums = array();
$get_table_colums = mysqli_query($capital_db,"SHOW COLUMNS FROM tbl_customers ");
while($found_table_colums = mysqli_fetch_array($get_table_colums))
{
$forms_colums[] = $found_table_colums['Field'];
}
array_shift($forms_colums);