问题描述
- 用php逐条读取mysql中的数据报错为什么??
-
<?php $con = mysql_connect("localhost:3306","root","123456") or die("数据库连接失败".mysql_error()); mysql_select_db("vote",$con) or die ("数据库选择失败".mysql_error()); mysql_query("set names utf8"); $a = mysql_query("select news from news"); $b = mysql_fetch_row($a); while($b = mysql_fetch_row($a)) { echo $b["0"].'<br>'; echo $b["1"].'<br>'; } ?>
为什么下面会报错??
Notice: Undefined offset: 1 in C:Program FilesApache Software FoundationApache2.2htdocsprojectbrief.php on line 25 Do you think it will Notice: Undefined offset: 1 in C:Program FilesApache Software FoundationApache2.2htdocsprojectbrief.php on line 25 Do you think it Notice: Undefined offset: 1 in C:Program FilesApache Software FoundationApache2.2htdocsprojectbrief.php on line 25
解决方案
数组越界,在你的这个php的25行
时间: 2024-11-29 19:40:59