//$conn = mysql_connect('localhost','root','root');
$conn = mysql_connect('127.0.0.1','root','root');
if(!$conn)
{
die(mysql_error());
}
mysql_query("set names 'utf8'");
$select_db = mysql_select_db('test');
if(!$select_db)
{
die(mysql_error());
}
$arr = array();
$res = mysql_query("select * from A ORDER BY ID ASC");
while($row=mysql_fetch_array($res))
{
//$arr[] = array($row['code'],$row['note']);
$arr[] = array('code'=>$row['code'],'note'=>$row['note']);
}
//print_r($arr);
?>
无标题文档
代码 |
内容 |
---|
echo $arr[$i]['code'];?> |
echo $arr[$i]['note'];?> |
mysql_close($conn);
?>