Heim  >  Artikel  >  Backend-Entwicklung  >  php 判断mysql是否到记录尾_PHP教程

php 判断mysql是否到记录尾_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:51:291067Durchsuche




文件尾

请问,我在查询数据表后。送出查询语句,要想判断他是否是文件尾。如果不是文件尾则运行“条件”while($result != EOF)这句好像不对?应该怎么写呢?
$sql="select * from table1";
$result=mysql_query($sql);
while($result != EOF)
{
条件
}


帮帮小弟。。学习中!!

我来回答




D8888D回贴内容-------------------------------------------------------
while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
print_r($row);
}

D8888D回贴内容-------------------------------------------------------
我是想判断文件尾。如果不是文件尾则运行条件。改成这样OK吗?
$sql="select * from table1";
$result=mysql_query($sql);
$row=mysql_fetch_array($result,MYSQL_ASSOC);
while ($row!=false)
{
条件
}

D8888D回贴内容-------------------------------------------------------
是文件尾,还是数组遍历。。。我晕了

D8888D回贴内容-------------------------------------------------------
我也晕了,我想实现查询数据表,然后判断是不是文件尾,如果不是文件尾就运行条件。如果是文件尾了就跳出循环.这个到底怎么做呢?[img]http://www.111cn.cn/bbs/images/smilies/default/sweat.gif[/img]
$result=mysql_query($sql);
$row=mysql_fetch_array($result,MYSQL_ASSOC);
while ($row!=false)
{
$nowdt=$CustRs["ac_exp_dt"];
$nowmon=$CustRs["ac_exp_mon"];
$nowyr=$CustRs["ac_exp_year"];
$daydiff=(strtotime(date("$nowyr"."-"."$nowmon"."-"."$nowdt")) - strtotime(date("Y-m-d")))/86400;
if ($daydiff else
{mysql_query("UPDATE CUSTOMERS SET Current_Status=1 where indexuid="$CustRS["indexuid"]"");}
}

D8888D回贴内容-------------------------------------------------------
e....我不明白你的概念:文件尾
你查询数据库跟文件有关系?

D8888D回贴内容-------------------------------------------------------
echo mysql_data_seek (mysql_num_rows($sql) -1, $db_resource_link);


复制代码

D8888D回贴内容-------------------------------------------------------
就是更新所有记录的一个字短.一条一条的更新,直到记录尾.

D8888D回贴内容-------------------------------------------------------
原帖由 loveyou_85 于 2009-3-6 17:22 发表 [url=http://bbs.111cn.cn/redirect.php?goto=findpost&pid=896058&ptid=107381]链接标记[img]http://bbs.111cn.cn/images/common/back.gif[/img][/url]
就是更新所有记录的一个字短.一条一条的更新,直到记录尾.
汗。。你不直接说栈操作

D8888D回贴内容-------------------------------------------------------
老大怎么写呢????


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632545.htmlTechArticle文件尾 请问,我在查询数据表后。送出查询语句,要想判断他是否是文件尾。如果不是文件尾则运行“条件”while($result != EOF)这句好像不对...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn