• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps fetching some data from database using json webservices

krishnaveni

Well-Known Member
Hi Good Evening,

am developed one app..here am using json webservices for fetching data from database...Here am used dis coding part:

<?php
$r=mysql_connect("localhost","root","");
mysql_select_db("xcart",$r);

$q=mysql_query("SELECT * FROM xcart_orders WHERE orderid >'".$_REQUEST['orderid']."'");

while($e=mysql_fetch_assoc($q))
{
$output[]=$e;
}
print(json_encode($output));



mysql_close();
?>
its successfully worked...but all datails displayed..because am used array.

but i dono how is fetching some datas only...here am used dis coding:

<?php
$r=mysql_connect("localhost","root","");
mysql_select_db("xcart",$r);

$q=mysql_query("SELECT * FROM xcart_customers WHERE usertype='C'") or die(mysql_error());

// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array( $q );
// Print out the contents of each row into a table
print(json_encode($row['firstname']." - ".$row['lastname']));

mysql_close();
?>
dis is successfully worked in localhost..then am connecting my coding means its displayederror in logcat..the error is json array exception not converted to json array ..how it is diplayed..i konw my coding part having error..so ly it is displayed..so give me some solutions...thank in advance...
 
Hi Good Evening,

how is fetching some data from the database using json web services...(eg)database having firstname,lastname,email,age all are thr means am fetching only firstname and lastname ...how it is do...plz help me friends...
 
Back
Top Bottom