mysql 纸 mysql_fetch_array OR mysql_fetch_assoc OR mysql_fetch_row
<?php
$con = mysql_connect("localhost", "root", "123456");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("d_star",$con);
$sql = "SELECT * from test";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_array($result));
echo '<hr>';
print_r(mysql_fetch_assoc($result));
echo '<hr>';
print_r(mysql_fetch_row($result));
echo '<hr>';
mysql_close($con);
?>
-------------------------以下是结果-----------------------------
Array | |
( | |
[0] => 1 | |
[id] => 1 | |
[1] => name | |
[name] => name | |
[2] => daodao,xiaohu,xiaoqin | |
[list] => daodao,xiaohu,xiaoqin | |
) | |
<hr>Array | |
( | |
[id] => 2 | |
[name] => name2 | |
[list] => xiaohu,daodao,xiaoqin | |
) | |
<hr>Array | |
( | |
[0] => 3 | |
[1] => name3 | |
[2] => xiaoqin,daodao,xiaohu | |
) | |
<hr> |