android - php - adding messages and setting date -
i don't know php @ , try rewrite example of using php android
i want android app send data - name , message , receive list of data json
now - have example :
<?php // post data $data = urldecode($_post['data']); $name = urldecode($_post['name']); $jsondata = array(); $jsontempdata = array(); $jsontempdata = array(); $jsontempdata['name'] = $name; $jsontempdata['number'] = $data; $jsontempdata['date_added'] = // don't know how set date $jsondata[] = $jsontempdata; $outputarr = array(); $outputarr['android'] = $jsondata; // encode array json data print_r( json_encode($outputarr)); ?>
which means send data , in 1 method , assume, wrong. how can separate them - sending data php , receiving json.i have repeat, got 0 knowledge in php.
plus it's 1 name-message pair wrapped array , need make array of messages , return them in json.oh, , need write time of message array
thank you
$jsontempdata['date_added'] = date('y-m-d');//to set date
if want various date formats check manual
if want return json data (you can return value if using function.)
return json_encode($outputarr);
if want dsplay
echo json_encode($outputarr);
Comments
Post a Comment