SQL Query怀疑示例代码

时间:2017-11-24 10:48:29

标签: php mysql sql

我正在尝试理解这个示例代码,如果你们可以在下面的例子中解释$ _GET函数如何检索数据,那将是一个很好的帮助。

function _addLog($Device, &$output)
{
   if(isset($_GET['Speed']))
   {
       $query =
       "INSERT INTO Log SET"
       ." Device = ?"
       .", LogDateTime = ?"
       .", PositionDateTime = ?"
       .", Lat = ?"
       .", Lng = ?"
       .", Speed = ?"
       .", Angle = ?"
       .", Log.InOut = false"
       .", Code = ?"
       .", Message = ?";

任何人都可以向我解释使用$ _GET获取这些值的代码部分吗?

   $params = array(
                    $Device,
                    date('Y-m-d H:i:s'),
                    $_GET['PositionDateTime'],
                    $_GET['Lat'],
                    $_GET['Lng'],
                    $_GET['Speed'],
                    $_GET['Angle'],
                    $_GET['Code'],
                    $_GET['Message']);
                   addObject($query, $params, $output);
            }
        }

1 个答案:

答案 0 :(得分:0)

@foreach ($tasks as $task) @foreach ($task->interactions as $interactions) {{ In here, every time my loop returns a status = "In progress" i should mark that time, and if that the next loop returns a "Paused", i should count the difference between these two. And sum all other equal cases in the loop. }} @endforeach @endforeach 个变量存储通过GET请求传递给$_GET的数据。这可以是从HTML提交的表单,如下所示:

php

<form method='get' action='some_file.php'> <input tye="text" name="name"> <input type="number" name = "age"> <input type="submit" value="Submit"> </form>

some_file.php

此处,<?php $name = $_GET['name']; $age = $_GET['age']; /* Some more processing here */ ?> 包含$name页面上“名称”输入文本框表单中输入的值。同样适用于HTML

此外,我们可以通过网址将$age个请求参数传递给GET: 例如,请考虑以下网址:php

此请求http://abc.xyz.com/some_file.php?name=Tom&age=10分别为URL$_GET['name']提供值“Tom”和“10”$_GET['age']