【发布时间】:2014-05-27 05:33:31
【问题描述】:
我这个程序我从数据库中获取列名,但是当尝试将它保存在一个数组中时,它将最后一个列名存储在一个数组中。如何将 eash 列名存储在数组中???
$sql="SHOW COLUMNS from itasd2015sem1semester";
if(($result=$conn->query($sql))==true){
while($row=$result->fetch_array()){
for($i=0;$i<11;$i++){
$sub[$i]=$row[0]."\n";
}
}
}
for($i=0;$i<sizeof($sub);$i++){
echo $sub[$i];
}
它只打印最后一列名称??
$sql="SHOW COLUMNS from itasd2015sem1semester";
if(($result=$conn->query($sql))==true){
while($row=$result->fetch_array()){
for($i=0;$i<11;$i++){
$sub[$i]=$row[$i]."\n";
}
}
}
for($i=0;$i<sizeof($sub);$i++){
echo $sub[$i];
}
它显示一个通知..并且它单独打印最后一列。
注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 6 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 7 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 8 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 9 注意:未定义的偏移量:第 21 行 C:\xampp\htdocs\new\test1.php 中的 10【问题讨论】: