PHP与mongodb数据表错误

时间:2017-06-14 13:18:55

标签: php mongodb datatable server-side-scripting

我在mongodb的数据表中出错了请给出解决方案... 如果有人有参考源代码发给我它会对我有帮助..................................... .................................................. .................................................. ...........................................

SELECT

[reference]

,dateadd(hh,1,[Start Time]) AS [Call Time]
,[type]
,[ring (ms)]/1000 AS [Ring Time]
,[connected (ms)]/1000 AS [connected]

,rtrim([rhoutcome]) AS [Outcome]

From 
[InboundCallsView] AS ICV  
LEFT JOIN ianalyse.[dbo].[iAnalyse3_iResultsHeaderXML] IRES 
ON  ICV.[Activation ID]  = IRES.[rhActivationId] 
AND ires.[rhAccountNo] = '310169'
 AND ([rhstarttime] BETWEEN '2017-06-13' AND '2017-06-14' OR [rhStartTime]    IS null)

WHERE [account] = '310169'

AND dateadd(hh,1,[Start Time]) BETWEEN '2017-06-13' AND '2017-06-14'

AND [type] <> 'Call diverted'

源代码:

Notice: Undefined index: iColumns in D:\xampp\htdocs\mongo\test3.php on line 47
Notice: Undefined index: sEcho in D:\xampp\htdocs\mongo\test3.php on line 129

 {"sEcho":0,"iTotalRecords":9,"iTotalDisplayRecords":9,"aaData":[{"_id":

 {"$id":"5936e5e783b236680c00002a"},"name":"Mitra","age":21,"gender":"M","course":"BTECH","marks":77}

1 个答案:

答案 0 :(得分:1)

这些不是错误,是通知:

$input

iColumns没有名为"sEcho" => intval($input['sEcho']), 的密钥。

$input

此处相同:sEcho没有名为$_REQUEST

的键

确保$_GET包含两个键。 或者您可以为通知禁用错误报告。

编辑: 你用:     $ input =&amp; $ _REQUEST; 您应该证明使用$_POSTiColumns取决于您将日期发送到服务器的方式,并确保发送sEcho$iColumns = isset($input['iColumns']) ? isset($input['iColumns']) : 10; 。 如果您的前端有一个表单并且您要发布数据,则可以验证输入字段,以便需要这两个变量或为它们提供默认值。

如果你想将它(例如)默认为10:

$sEcho = isset($input['sEcho'] ? intval($input['sEcho']) : 10;
$output = array(
    "sEcho" => $sEcho,
    "iTotalRecords" => $m_collection->count(),
    "iTotalDisplayRecords" => $cursor->count(),
    "aaData" => array(),
);

和(不确定sEcho索引用于:

[root@server ]$ vi /etc/php.ini
error_reporting = E_ALL & ~E_NOTICE

那不应该给你任何通知。

其他选项,禁用通知报告:

error_reporting(E_ALL & ~E_NOTICE);

或者,在你的php文件的顶部:     {{1}}