<?php

//get table field VALUES for select box

$table=$_GET['table'];

require ("./include/connect_db.php");
mysql_select_db($globalConfig['dbname'], $link) or die("couldn't select database");

$detailsresult=mysql_query("SELECT * FROM ".$globalConfig['dbprefix']."$table ");


  $json = '['; // start the json array element
  $json_names = array();

	while($detailsresultrow=mysql_fetch_array($detailsresult)){
	
		$description="$detailsresultrow[folder] $detailsresultrow[file] $detailsresultrow[url] $detailsresultrow[last_uk] $detailsresultrow[first_uk] $detailsresultrow[title_uk],$detailsresultrow[title_jp]";
		
		$description= substr($description,0, 255);
		
		$json_names[] = "{optionValue: '$detailsresultrow[id]', optionDisplay: '$description'}";
		
	}
  
  $json .= implode(',', $json_names); // join the objects by commas;
  $json .= ']'; // end the json array element
  echo $json;



?>