php - How to get mysql row count using JSON parsing onto Android TextView? -


i have php file returns single number (i.e. 360). how can number appear in android textview. able arrays this:

{"success":1,"message":"post available!","posts":[{"name":"john smith","id":"1"}, ...]} 

but how can single number.

here php:

<?php  include('connect.php');  $gettotal=mysql_query("select * records"); totalrecords=mysql_num_rows($gettotal); echo json_encode($totalrecords);  ?> 

thanks.

a number still going number after json_encode() it.

$num = 42; $json = json_encode($num); echo "$num / $json" 

will output 42 / 42 - there no practical difference between two.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -