首页 > 数据库技术 > 详细

mysql_fetch_row mysql_fetch_array

时间:2014-05-08 09:54:41      阅读:433      评论:0      收藏:0      [点我收藏+]

1 mysql_fetch_row  mysql_fetch_array

1.1 mysql_fetch_row

<?php
while($row = mysql_fetch_row($result)){
$n=0;

?>
<b><span style=""> 
<?php
if($n==0){
echo $row [14];

?>

1.2 mysql_fetch_array

注释:mysql_fetch_array() 是 mysql_fetch_row() 的扩展版本。除了将数据以数字索引方式储存在数组中之外,还可以将数据作为关联索引储存,用字段名作为键名

例子

<?php
$con = mysql_connect("localhost", "hello", "321");
if (!$con)
  {
  die(‘Could not connect: ‘ . mysql_error());
  }

$db_selected = mysql_select_db("test_db",$con);
$sql = "SELECT * from Person WHERE Lastname=‘Adams‘";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_array($result));

mysql_close($con);
?>

 

 

mysql_fetch_row mysql_fetch_array,布布扣,bubuko.com

mysql_fetch_row mysql_fetch_array

原文:http://www.cnblogs.com/cd-snoopy/p/3714560.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!