我有5个sp_id,$ count也给了5个。但是当我通过mysqli_fetch_array检查大小时,它给出了我的大小2并且只打印1并且给出了错误未定义的偏移:1进一步。我想获得id的值,我的意思是通过for循环打印ID。
$selectId="Select sp_id from stitchedproduct";
$selectIdR = mysqli_query($connection,$selectId) or die(mysqli_error($connection));
$count = mysqli_num_rows($selectIdR);
$fetchedResult= mysqli_fetch_array($selectIdR);
for ($i=0;$i < $count; $i++) {
print $fetchedResult[$i];
}
答案 0 :(得分:0)
替换
$fetchedResult= mysqli_fetch_array($selectIdR);
for ($i=0;$i < $count; $i++) {
print $fetchedResult[$i];
}
带
while( $fetchedResult= mysqli_fetch_array($selectIdR)) {
print $fetchedResult['sp_id'];
}