【发布时间】:2012-09-03 02:00:17
【问题描述】:
我想从 url 获取数据。在这种情况下,我已经完成了数据转换为 json 并在 localhost (http://localhost/adchara1/index.php/?year=1) 中运行的完整 php
这是php脚本
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$q=mysql_query("SELECT * FROM people
WHERE
birthyear>'".$_REQUEST['year']."'");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close(); ?>
这就是结果
[{"id":"1","name":"kongkea","sex":"1","birthyear":"1990"}, {"id":"2","name":"thida","sex":"0","birthyear":"2000"}]?>
我想使用按钮单击并在 textview 中显示此结果
【问题讨论】:
-
实际上你想问什么?同样的android代码或者你有任何疑问?
-
在android中,我想从结果中获取url以显示在android的textView中。例如,在 android 中,我有 1 个按钮和 1 个 TextView,我想在 url
[{"id":"1","name":"kongkea","sex":"1","birthyear":"1990"}, {"id":"2","name":"thida","sex":"0","birthyear":"2000"}]?>中获取结果以显示在 TextView 中。