Duplicate MC and Arrange like a table

I have this site i am puting together and it uses php and mysql to create all of my project buttons. i am able to list all of them but i need help with the duplicatemovieclip where after every 6th button the next ones appear 147 more pixels to the right. i got it to work by using simple “if” statements but i would like it to be able to do it by itself.

it would look like the attached picture, but when i add more elements more columns get added too

here is my script that i use:

 
projects = new LoadVars();
projects.onLoad = function() {
num = projects.numRows;
Process(num);
};
function Process(num) {
d = num;
fake_height = (d)*20;
items_mc.attachMovie("fake", "fake", 1000, {_y:fake_height});
for (var c = 0; c<d; c++) {
 
 
 
 
//HELP NEEDED HERE
  duplicateMovieClip(items_mc.p_mc, "p_mc"+c, c);
  this.items_mc["p_mc"+c]._y = (20*c);
 
//MY IF STATEMENT THAT STARTS COLUMN TWO
  if (c > 5) {
   this.items_mc["p_mc"+c]._x = 147;
   this.items_mc["p_mc"+c]._y = (20*(c-6));
}
//
 
 
 
  this.items_mc["p_mc"+c].the_txt.p_txt.text = projects["title"+c];
  this.items_mc["p_mc"+c].graphic = projects["picture"+c];
  this.items_mc["p_mc"+c].details = projects["description"+c];
  this.items_mc["p_mc"+c].link_to = projects["link"+c];
  this.items_mc["p_mc"+c].clients = projects["client"+c];
  this.items_mc["p_mc"+c].titletext = projects["title"+c];
  this.items_mc["p_mc"+c]._alpha = 0;
  this.items_mc["p_mc"+c].enabled = false;
  this.items_mc["p_mc"+c].onReleaseOutside = function() {
   this.unplay();
  };
  this.items_mc["p_mc"+c].onLoad = this.items_mc["p_mc"+c].onRollOut=function () {
   this.ititalpha = 0;
  };
  this.items_mc["p_mc"+c].onEnterFrame = function() {
   this._alpha == 100 ? delete this.onEnterFrame : this._alpha=this._alpha+(this.ititalpha-this._alpha)/2;
  };
  this.items_mc["p_mc"+c].onRollOut = function() {
   this.unplay();
  };
  this.items_mc["p_mc"+c].onRollOver = function() {
   this.play();
   this.sounds();
  };
}
}
i = 0;
this.onEnterFrame = function() {
if (i != num) {
  this.items_mc["p_mc"+i].ititalpha = 100;
  if (this.items_mc["p_mc"+i]._alpha>60) {
   i++;
  }
} else {
  for (i=0; i<num; i++) {
   this.items_mc["p_mc"+i]._alpha = 100;
   this.items_mc["p_mc"+i].enabled = true;
  }
  delete this["onEnterFrame"];
}
};
projects.load("[projects.php](http://www.trp-florida.com/flash/projects/projects.php)");

thanks to anyone who can help