Your IP : 216.73.216.97


Current Path : /var/www/clients/client3/web2/web/lists/admin/actions/
Upload File :
Current File : /var/www/clients/client3/web2/web/lists/admin/actions/searchemail.php

<?php

//[ { "id": "Alcedo atthis", "label": "Common Kingfisher", "value": "Common Kingfisher" }, { "id": "Haliaeetus leucoryphus", "label": "Pallas’s Fish Eagle", "value": "Pallas’s Fish Eagle" }, { "id": "Ceryle alcyon", "label": "Belted Kingfisher", "value": "Belted Kingfisher" } ]

exit; //# unfinished code

$req = Sql_Query(sprintf('select id,email as label, email as value from %s where email like "%s%%" limit 10',
    $tables['user'], $_GET['term']));
$results = array();
while ($row = Sql_Fetch_Assoc($req)) {
    $results[] = $row;
}
//var_dump($results);

//# hmm, doesn't work
//print json_encode($results);

$out = '[ ';
foreach ($results as $match) {
    $out .= '{ "id": "'.$match['id'].'", "label:"'.$match['label'].'", "value": "'.$match['value'].'" },';
}
$out = substr($out, 0, -1);
echo $out.']';
exit;