2 u010990330 u010990330 于 2013.06.07 14:42 提问

用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 Files\Apache Software Foundation\Apache2.2\htdocs\project\brief.php on line 25

Do you think it will 

Notice: Undefined offset: 1 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\project\brief.php on line 25

Do you think it

Notice: Undefined offset: 1 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\project\brief.php on line 25

1个回答

Jave_
Jave_   2013.06.07 15:20

数组越界,在你的这个php的25行

u010990330
u010990330 谢谢了。。。。。。
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!