我期待在一个应用程序上工作,其中用户可以通过应用程序,这是存储在数据库中的信息。使用sql查询,我希望返回值并将其输出到应用程序上,以便用户在单击"View Notes“按钮时可以阅读它。
在PHP中保存的SQL查询
<?php
include 'connect.php';
$id = $_POST['UserID'];
$query_search = "select MedicalNotes from PatientRecords where PatientID = 1";
$result = mysql_query($query_search) or die(mysql_error());
$row = mysql_fetch_array($result);
?>然后,当用户单击"View Notes“按钮时,我想通过应用程序运行此查询。
我应该使用,
httppost = new HttpPost(
"http://database.location.ac.uk/app/queries/notes.php");发布于 2013-05-22 21:11:59
看看这个(link)。
下面是一个可能有用的小示例:
SQLiteDatabase myDB = SQLiteDatabase.openDatabase("myDatabase.db", null, SQLiteDatabase.OPEN_READONLY);
String select = "select MedicalNotes from PatientRecords where PatientID = 1";
Cursor dbCursor = myDB.rawQuery(select, null);
dbCursor.moveToFirst();
while (dbCursor.isAfterLast() == false)
{
// Do stuff here with Cursor's getXXX method
// ex. String data = dbCursor.getString(0);
dbCursor.moveToNext();
}
dbCursor.close();https://stackoverflow.com/questions/16691776
复制相似问题