首頁 >後端開發 >php教程 >度数据库报错-用php逐条读取mysql中的数据报错为什么??

度数据库报错-用php逐条读取mysql中的数据报错为什么??

WBOY
WBOY原創
2016-06-02 11:34:561172瀏覽

度数据库报错php

<code><?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>';        }?></code>

为什么下面会报错??

<code>Notice: Undefined offset: 1 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\project\brief.php on line 25Do you think it will Notice: Undefined offset: 1 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\project\brief.php on line 25Do you think itNotice: Undefined offset: 1 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\project\brief.php on line 25</code>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn