Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old January 25th, 2012, 05:15 AM   #1 (permalink)
Junior Member
 
Join Date: Dec 2011
Location: chennai
Posts: 61
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default fetching some data from database using json webservices

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...

krishnaveni is offline  
Reply With Quote
Sponsors
Old January 25th, 2012, 08:10 AM   #2 (permalink)
Junior Member
 
Join Date: Dec 2011
Location: chennai
Posts: 61
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default fetching some data from database using json webservices

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...
krishnaveni is offline  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 12:09 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo