خرید بک لینک

Vote count: 0

Here's the relevant part of my code:

$json = file_get_contents('php://input');

$obj = json_decode($json, true);
$device_id =$obj['device_id'];
$num =$obj['sensor_value'];
$sensor_value =(int)$num;


if ($sensor_value > 100){
    $sql = "INSERT INTO rr_emergency (device_id,sensor_value) VALUES('$device_id','$sensor_value');";
    $result = $dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
}
else {

    $sql = "INSERT INTO general_logging (device_id,sensor_value) VALUES('$device_id','$sensor_value');";
    $result = $dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
}

The else statement works fine. However, when $sensor_value is greater than 100, the IF part of my statement never fires. What am I missing here?

asked 15 secs ago

- - , .
.

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 23 تير 1395 ساعت: 7:41

صفحه بندی