search
Homephp教程php手册php 判断mysql是否到记录尾

php 判断mysql是否到记录尾

Jun 13, 2016 am 09:53 AM
mysqlphpjudgmentbackexistIdata sheetyesInquireRecordstatement




文件尾

请问,我在查询数据表后。送出查询语句,要想判断他是否是文件尾。如果不是文件尾则运行“条件”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回贴内容-------------------------------------------------------
老大怎么写呢????


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools