2011-10-03 07:50
浏览 52

如何使用PHP Web服务从MySQL向Android客户端显示值

I have question regarding on how to display the values into the Android Client from online database in MySQL using the PHP Web Service. The idea is such that initially when the activity is displayed, the first record must be displayed in the textview. There would be a button called Next which would display the next record and move the cursor to the next record in the database. My question is that the move to next record logic should be written in which place? That means should I write the move-to-next-record code in the Android client or should I write in the PHP code?

For the basic understanding of how to connect to an online db in Android Client I had referred to the question in this forum itself: Connect to Remote DB which gave me a good understanding on how to connect to remote db. But here my idea is kind of different which is event based and has to move to the next record and display in the textview. Any hints and suggesstions? Very grateful if you help me! Thank you.

图片转代码服务由CSDN问答提供 功能建议

我对如何使用PHP Web服务从MySQL中的在线数据库将值显示到Android客户端有疑问 。 这样的想法是,最初在显示活动时,必须在textview中显示第一条记录。 将有一个名为Next的按钮,它将显示下一条记录并将光标移动到数据库中的下一条记录。 我的问题是,转向下一个记录逻辑应该写在哪个地方? 这意味着我应该在Android客户端编写移动到下一个记录的代码,还是应该用PHP代码编写?

为了基本了解如何在Android客户端连接到在线数据库,我在本论坛中提到了这个问题: 连接到远程数据库,这让我对如何连接到远程数据库有了很好的理解。 但在这里我的想法有点不同,这是基于事件的,必须移动到下一个记录并显示在textview中。 任何提示和建议? 非常感谢您的帮助! 谢谢。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duankuaiwang2706
    duankuaiwang2706 2011-10-03 08:15

    It is really bad idea to connect directly to database. AFAIK, you can create a PHP/MySQL Service to return data in such a format that clients can parse, like popular JSON.
    Have a look at this:
    Hope it helps!

    点赞 评论