Форуми / Cotonti / Support / Question about Json requests

Trustmaster
#37314 27.03.2013 06:29

It's as simple as this:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php defined('COT_CODE') or die('Wrong URL.');
/* ====================
[BEGIN_COT_EXT]
Hooks=ajax
[END_COT_EXT]
==================== */
 
if ($usr['id'] > 0 && COT_AJAX)
{
    require_once cot_incfile('pm', 'module');
    if ($usr['newpm'])
    {
        echo json_encode($db->query("SELECT * FROM $db_pm WHERE pm_touserid=? AND pm_tostate=0", $usr['id'])->fetchAll());
    }
}

 

May the Source be with you!