The app which i am making is going to run on 8 android devices at a time and when the first device runs app i.e fetches the data from web service it should give it the data of 1st ten fields from the data base.
when any other user wants it should give the data of next 10 fields etc but how can i implement this in php web service when i use Limit $i,10 then i initialize $i=0 in the start of web service and the issue is that whenever any user access the web service the same web service code executes i mean that the $i is again reset to 0 in the start what should i do?
I want the when the webservice first access the database the start 10 fileds data is given to it and even ever it accessess the database again the next 10 fields data is given to it and so on...
this is my php webservice code
$i=0;
$q=mysql_query("SELECT * FROM users1 where status='failed' OR status='ready' LIMIT $i,10 ");
while($row=mysql_fetch_assoc($q))
$json_output[]=$row;
echo json_encode($json_output);
From the android side you could add a flag
in the url to know what the client requires. For example,
If client needs first 10 fields, he could call
http://your.url.com/code.php?offset=0
if he needs the later, he would call
http://your.url.com/code.php?offset=10
You could get the value of offset
in your php file using $offset = $_GET['offset'];
Then you could run the query desired by the client.
You can add limit and offset to request (GET or POST) that sends from android apps.
But if each app does not know about last requested by another app you can store last limit and offset, for example in database. Then on each request restore $i from dbase.