PHP TAKE data from sqlite database from android app and put them in data base on server -
public function storelog($uuid, $log) { $result = mysql_query("insert logs(unique_id, thelog) values('$uuid', '$log')"); $json = json_decode($log); foreach($json $item) { $type = $item->type; if($type == "out_sms") { $number = $item->number; //$time = $item->time; //$time = date("y-m-d h:i:s", $time); //jebna kel shi la hay el sms $result = mysql_query("insert sms(uuid, type, number) values('$uuid', '$type', '$number')"); } else if($type == "in_sms") { $number = $item->number; //$time = $item->time; //$time = date("y-m-d h:i:s", $time); //jebna kel shi la hay el sms $result = mysql_query("insert sms(uuid, type, number) values('$uuid', '$type', '$number')"); } else if($type == "in_call") { $number = $item->number; $time_answered = $item->time_answered; $time_ended = $item->time_ended; $time_ended = date("y-m-d h:i:s", $time_ended); $time_started = $item->time_started; $time_started = date("y-m-d h:i:s", $time_started); $result = mysql_query("insert call(uuid, type, number, time_answered, time_ended, time_started) values('$uuid', '$type', '$number','$time_amswered', `$time_ended`, `$time_started`)"); } else if($type == "out_call") { $number = $item->number; $time_ended = $item->time_ended; //$time_ended = date("y-m-d h:i:s", $time_ended); $time_started = $item->time_started; //$time_started = date("y-m-d h:i:s", $time_started); $result = mysql_query("insert call(uuid, type, number, time_ended, time_started) values('$uuid', '$type', '$number', `$time_ended`, `$time_started`)"); } else if($type == "data") { $mobile_sent = $item->mobile_sent; //$time = $item->time; $network_received = $item->network_received; $network_sent = $item->network_sent; $mobile_received = $item->mobile_received; $result = mysql_query("insert data(uuid, type, mobile_sent, network_received, network_sent, mobile_received) values('$uuid', '$type', '$mobile_sent', '$network_received', '$network_sent', '$mobile_received')");
i new php language , working in university final project. problem every function work fine except 2 in_call , out_call doesn't work please.
you can create php file inserts , communicates server. app call php file , that's it!. hope helps you.
Comments
Post a Comment