简体   繁体   中英

How to check if MySQL table has next row from Java/Android

I was thinking what is a nice way to check if database has a next row? I have an android app, which is consuming PHP web service and I have MySQL database ('dummy').

public class myAwesomeClass extends Activity{
    public void onButtonClicked(View view){
       if (dummy has row){
           //do something
           //and proceed to next row
        }
          else {
          //something else
            }
        }
    }

Hos does it work? Is there a "special" query in MySQL, or method in PHP? Or is it possible to do it directly within the app? Examples, suggestions, links - everything is appreciated. Thanks

您无需检查数据库是否有下一行,而是从数据库中获取的结果集是否包含另一个对象。在Java中(自您提到Android以来),当您从ResultSet对象中从数据库中获取结果时,可以循环遍历结果并通过ResultSet.hasNext()检查它是否有下一行

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM