0
    public function storeLog($uuid, $log) {
    $result = mysql_query("INSERT INTO logs(unique_id, thelog) VALUES('$uuid', '$log')");
    $json = json_decode($log);

    foreach($json as $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 INTO 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 INTO 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 INTO 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 INTO 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 INTO data(UUID, TYPE, MOBILE_SENT, NETWORK_RECEIVED, NETWORK_SENT, MOBILE_RECEIVED) VALUES('$uuid', '$type', '$mobile_sent', '$network_received', '$network_sent', '$mobile_received')");

私はphp言語を初めて使用し、大学の最終プロジェクトに取り組んでいます。問題は、2 つの in_call と out_call を除いて、すべての関数が正常に動作することです。

4

1 に答える 1

0

サーバーに挿入して通信するphpファイルを作成できます。次に、アプリはこのphpファイルを呼び出すだけで、それだけです!. これがお役に立てば幸いです。

于 2013-03-25T08:45:35.193 に答える