This question has been answered by dvstudiosinc. See the first response.
Or is there a better way to refresh a db table with completely new data on a daily basis?
http://rtfm.modx.com/xpdo/2.x/getting-started/using-your-xpdo-model/removing-objects/removecollection
Or is there a better way to refresh a db table with completely new data on a daily basis?
That would depend on where the data is coming from. If the data is coming from an external file (like a CSV) then this is the fastest way: http://dev.mysql.com/doc/refman/5.1/en/load-data.html. In MODX terms: http://forums.modx.com/thread/75808/xpdo-bulk-insert
//$jArray is an array created from the JSON feed pulled in from a cURL call foreach($jArray as $item){ $values[]="(NULL,'".$item['skillid']."','".$item['jobid']."')"; } $columnValues = implode(',',$values); //-->Remove all rows and reset autoincrement $modx->exec("TRUNCATE TABLE {$modx->getTableName('JobSkill')}"); //-->>save the imploded values to the table via INSERT. $modx->exec("INSERT INTO {$modx->getTableName('JobSkill')} (`id`, `skillid`, `jobid`) VALUES {$columnValues}");