Forums / Cotonti / Support / Question about Json requests

Trustmaster
#37314 2013-03-27 06:29

It's as simple as this:

<?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!