29 lines
1.9 KiB
PHP
29 lines
1.9 KiB
PHP
<?php
|
|
|
|
require('include/glob.php');
|
|
require('include/muoribene.php');
|
|
require('include/sessionstart.php');
|
|
|
|
$cols=array(
|
|
'PlaceID'=>array('select'=>'SELECT Places.ID AS Pid, CONCAT(Locality,\' (\',COUNT(Places.ID),\')\') AS Txt FROM Instances LEFT JOIN Places ON Places.ID=PlaceID WHERE PlaceID IS NOT NULL ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
|
|
'LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',COUNT(Languages.ID),\')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
|
|
'OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',COUNT(Languages.ID),\')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
|
|
'FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID GROUP BY Financing.ID ORDER BY Type ASC ','optcol'=>'Fid','txtcol'=>'Txt'),
|
|
'PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
|
|
'TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
|
|
);
|
|
|
|
if (array_key_exists('key',$_GET) && array_key_exists($_GET['key'],$cols)) {
|
|
require('include/myconn.php');
|
|
$res=mysqli_query($link,$cols[$_GET['key']]['select'])
|
|
or muoribene(mysqli_error($link),true);
|
|
mysqli_close($link);
|
|
$buf=array();
|
|
while ($row=mysqli_fetch_assoc($res))
|
|
$buf[]=array($row[$cols[$_GET['key']]['optcol']],$row[$cols[$_GET['key']]['txtcol']]);
|
|
echo(json_encode($buf));
|
|
}
|
|
|
|
exit(0);
|
|
|
|
?>
|