A friend and I are trying to create a dynamic system for editing news. We both believe our scripts look pretty good and cannot seem to figure out why the variables are not being loaded. We completely scrapped both our codes and worked from the ground up, but it is still not working. Code included.

The functions code:

//populating the combobox "dropDown"
function AddItems(){
	numItems = myData.NumItems;
	for (i=0; i<numItems; i++){
		var Name = eval("myData.Name"+i);
		var TextData = eval("myData.TextData"+i);
		var Author = eval("myData.Author"+i);
		var TheDate = eval("myData.TheDate"+i);
		var ListBoxData = { TextData:TextData, Author:Author, TheDate:TheDate};
		dropDown.addItem(Name, ListBoxData);
//loading variables into text boxes
function SelectItem(){
	_root.texttxt = dropDown.getSelectedItem().data["TextData"];
	_root.datetxt = dropDown.getSelectedItem().data["TheDate"];
	_root.authortxt = dropDown.getSelectedItem().data["Author"];
The loader actions:

myData = new LoadVars();

myData.onLoad = AddItems;

The PHP script:

//Just testing

	or die ('Could not connect to database, faggot');
	or die ('Yeah, your database was found, but not the tables! Faggot.');
$result = mysql_query('SELECT * FROM news') or die ('no query, fag!');

if ($result) {
while ($tablefield = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $id[$i] = $tablefield['id'];
        $title[$i] = $tablefield['title'];
        $author[$i] = $tablefield['author'];
        $thedate[$i] = $tablefield['date'];
        $text[$i] = $tablefield['story'];
     while ($j < $i) {
        $Name         = $title[$j];
        $TextData     = $text[$j];
        $Author       = $author[$j];
        $TheDate      = $thedate[$j];
        print "&";
        print "Name$i=$Name&TextData$i=$TextData&Author$i=$Author&TheDate$i=$TheDate";

print '&NumItems=' . $j . '';

Been stuck for days... please help!