# tinyMCE

**URL:** <https://forum.kirupa.com/t/tinymce/230876>\
**Category:** Uncategorized\
**Created:** [June 29, 2007, 5:02pm UTC](https://forum.kirupa.com/t/tinymce/230876 "2007-06-29T17:02:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![philsbury](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@philsbury](https://forum.kirupa.com/u/philsbury)\
**Post date:** [June 29, 2007, 5:02pm UTC](https://forum.kirupa.com/t/tinymce/230876/1 "2007-06-29T17:02:14Z")

</div>

Hi,

This is kind of PHP, but the plugin is Javascript so added it here too!

I am trying to create an external image list using TinyMCE. My code is as follows:

```php
<script language="javascript" type="text/javascript" >
var tinyMCEImageList = new Array(
	// Name, URL
	
);
</script>
<?  
$trenn = ","; 
echo 'var tinyMCEImageList = new Array( 
'; 
include "library/config.php";
include "library/opendb.php"; 

	$query = "SELECT id, title, name, type, size, content FROM images";
	$result = mysql_query($query) or die('Error, query failed');
if ($result) 
{ 
while ($r = mysql_fetch_array($result)) 

	{ 
$link = $r["id"]; 
$name = $r["title"]; 
echo '["'.$name.'", "viewimage.php?id='.$link.'"]'; 
echo $trenn; 
} 
} 
echo "",""; 
echo ');'; 

	include 'library/closedb.php';	
	exit;

		
?>

```

This creates an array as follows:  
var tinyMCEImageList = new Array( [“a title”, “viewimage.php?id=5”],[“wallpaper 5”, “viewimage.php?id=6”],[“vvbksdvbjkdfb”, “viewimage.php?id=7”],);

But when I open the add image bit no menu displays. There is a comma after the last file which i think might be the problem, but can’t seem to get rid of it.

If anyone can help it would be great!

Thanks  
Phil
