⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysql-实用技巧-23.htm

📁 微软数据库开发梦工场多媒体教学-My sql篇.rar
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#000000" text="#FFFFFF">
<p>(14) array mysql_fetch_row(int result); </p>
<p>  作为一个数组返回给定结果集的下一行,如果没有更多的行,则返回假。<br>
    列值可作为数组元素访问,在0到mysql_num_fields()-1范围内使用列索引。 </p>
<p>&lt;?php </p>
<p>$link=mysql_pconnect(&quot;localhost&quot;,&quot;sunsoft&quot;,&quot;suixiang&quot;) 
  <br>
  or die(&quot;Could not connect&quot;); </p>
<p>mysql_select_db(&quot;stamp_db&quot;) or die(&quot;Could not select database&quot;); 
</p>
<p><br>
  $query=&quot;SELECT last_name,first_name FROM president&quot;; </p>
<p>$result=mysql_query($query) or die(&quot;Query failed&quot;); </p>
<p>while($row=mysql_fetch_row($result)) </p>
<p>printf(&quot;%s %s&lt;BR&gt;</p>
<p>&quot;,$row[0],$row[1]); </p>
<p>mysql_free_result($result); </p>
<p>?&gt; </p>
<p><br>
  (15) string mysql_field_name(int result, int field_index); </p>
<p>   返回结果集的给定列的名称。 <br>
  col_num 的范围为0到mysql_num_fields()-1. </p>
<p>&lt;?php </p>
<p>$link=mysql_pconnect(&quot;localhost&quot;,&quot;sunsoft&quot;,&quot;suixiang&quot;) 
  <br>
  or die(&quot;Could not connect&quot;); </p>
<p>mysql_select_db(&quot;stamp_db&quot;) or die(&quot;Could not select database&quot;); 
</p>
<p><br>
  $query=&quot;SELECT * FROM president&quot;; </p>
<p>$result=mysql_query($query) or die(&quot;Query failed&quot;); </p>
<p>for($i=0;$i&lt;mysql_num_fields($result);$i++) </p>
<p>{ </p>
<p>printf(&quot;Name of column %d:&quot;,$i); </p>
<p>$name=mysql_field_name($result,$i); </p>
<p>if(!$name) </p>
<p>print(&quot;No name available&lt;BR&gt;</p>
<p>&quot;); </p>
<p>else </p>
<p>print(&quot;$name&lt;BR&gt;</p>
<p>&quot;); </p>
<p>} </p>
<p>?&gt;<br>
</p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -