只能取第一条记录?错在哪? mysql_num_rows取得传回列的数目。语法: int mysql_num_rows(int result); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 刚才没有仔细看。$i = 0;while ($row=mysql_fetch_row($result)){?> <table border=1 cellpadding=0 cellspacing=0> <tbody> <tr> <form action=edit_type.php method=post> <td height="22"> <input type="submit" name="del" value="删除"> </td> <td height="22"> <input name="type_name" value="<? echo $row[$i];?>"> </td> <td height="22"> <input type="submit" name="repire" value="修改"> </td> </form> </tr> </tbody> </table><?$i++;}?> <?$connection = @mysql_connect("localhost","root","root" )or die("无法连接到数据库!"); @mysql_select_db("book",$connection)or die("无法选择数据库!"); $query = "select * from type order by type_id desc";$result = @mysql_query($query,$connection) or die ("数据库调用失败!");$row=mysql_fetch_array($result);$j=mysql_num_rows($result);for($i=0;$i<$j;$i++){?> <table border=1 cellpadding=0 cellspacing=0> <tbody> <tr> <form action=edit_type.php method=post> <td height="22"> <input type="submit" name="del" value="删除"> </td> <td height="22"> <input name="type_name" value="<? echo $row["type_name"];?>"> </td> <td height="22"> <input type="submit" name="repire" value="修改"> </td> </form> </tr> </tbody> </table><?}?> webmin(webmin) 还是不行,只有第一条记录 junxiao(骏枭) 这样肯定不行的 echo $j;看总共多少条记录?for($i=0;$i<$j;$i++){.....$row=mysql_fetch_array($result);} 将 原文中的 <input name="type_name" value="<? echo $row[$i];?>"> $row[$i]该为 $row["字段名称"]; 同意楼上的 用$row=mysql_fetch_array($result);$row是命名数组应该使用$row['字段名']来调用 $row=mysql_fetch_array($result);这一句应在 for循环里面才行!!! 我的方法...$j=0;//$j 用来计量有多少条记录while(list($tpye_name)=mysql_fetch_array($result)){?> <table border=1 cellpadding=0 cellspacing=0> <tbody> <tr> <form action=edit_type.php method=post> <td height="22"> <input type="submit" name="del" value="删除"> </td> <td height="22"> <input name="type_name" value="<? echo $row[$i];?>"> </td> <td height="22"> <input type="submit" name="repire" value="修改"> </td> </form> </tr> </tbody> </table><?}?>应该可以 我的方法...$j=0;//$j 用来计量有多少条记录while(list($tpye_name)=mysql_fetch_array($result)){?> <table border=1 cellpadding=0 cellspacing=0> <tbody> <tr> <form action=edit_type.php method=post> <td height="22"> <input type="submit" name="del" value="删除"> </td> <td height="22"> <input name="type_name" value="<? echo $row[$i];?>"> </td> <td height="22"> <input type="submit" name="repire" value="修改"> </td> </form> </tr> </tbody> </table><?}?>应该可以 有办法在php+win上实现多进程吗? 一个无限分类的问题,已基本实现。请帮忙完善一下。 php程序调试出错?新手求助 php无法连接mysql数据库,查了半天没有解决,反而更糊涂了 正则? APACHE重定向的问题 高手看过来,php下运行linux命令的问题 关于判断数据库是否有相同数据的问题 phpwind 图片上传问题! 做一个按钮控制图片变大再做一个控制同一个图片变小按照一定的比例 用js做 倒序问题,为何加了order by id desc 与没加一样 请问再php中怎样调用sql server的存储过程呀
$i = 0;
while ($row=mysql_fetch_row($result)){
?>
<table border=1 cellpadding=0 cellspacing=0>
<tbody>
<tr>
<form action=edit_type.php method=post>
<td height="22">
<input type="submit" name="del" value="删除">
</td>
<td height="22">
<input name="type_name" value="<? echo $row[$i];?>">
</td>
<td height="22">
<input type="submit" name="repire" value="修改">
</td>
</form>
</tr>
</tbody>
</table>
<?
$i++;
}
?>
$connection = @mysql_connect("localhost","root","root" )or die("无法连接到数据库!");
@mysql_select_db("book",$connection)or die("无法选择数据库!");
$query = "select * from type order by type_id desc";
$result = @mysql_query($query,$connection) or die ("数据库调用失败!");
$row=mysql_fetch_array($result);
$j=mysql_num_rows($result);
for($i=0;$i<$j;$i++){
?>
<table border=1 cellpadding=0 cellspacing=0>
<tbody>
<tr>
<form action=edit_type.php method=post>
<td height="22">
<input type="submit" name="del" value="删除">
</td>
<td height="22">
<input name="type_name" value="<? echo $row["type_name"];?>">
</td>
<td height="22">
<input type="submit" name="repire" value="修改">
</td>
</form>
</tr>
</tbody>
</table>
<?
}
?>
还是不行,只有第一条记录
这样肯定不行的
看总共多少条记录?
for($i=0;$i<$j;$i++){.....$row=mysql_fetch_array($result);
}
原文中的 <input name="type_name" value="<? echo $row[$i];?>"> $row[$i]该为 $row["字段名称"];
用$row=mysql_fetch_array($result);
$row是命名数组
应该使用
$row['字段名']来调用
这一句应在 for循环里面才行!!!
...
$j=0;//$j 用来计量有多少条记录
while(list($tpye_name)=mysql_fetch_array($result))
{
?> <table border=1 cellpadding=0 cellspacing=0>
<tbody>
<tr>
<form action=edit_type.php method=post>
<td height="22">
<input type="submit" name="del" value="删除">
</td>
<td height="22">
<input name="type_name" value="<? echo $row[$i];?>">
</td>
<td height="22">
<input type="submit" name="repire" value="修改">
</td>
</form>
</tr>
</tbody>
</table>
<?}?>
应该可以
...
$j=0;//$j 用来计量有多少条记录
while(list($tpye_name)=mysql_fetch_array($result))
{
?> <table border=1 cellpadding=0 cellspacing=0>
<tbody>
<tr>
<form action=edit_type.php method=post>
<td height="22">
<input type="submit" name="del" value="删除">
</td>
<td height="22">
<input name="type_name" value="<? echo $row[$i];?>">
</td>
<td height="22">
<input type="submit" name="repire" value="修改">
</td>
</form>
</tr>
</tbody>
</table>
<?}?>
应该可以