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 语言的新手,正在我的大学期末项目中工作。问题是每个函数都可以正常工作,除了两个 in_call 和 out_call 它没有任何帮助。