Forums / Developer / Bug with sections in roles? / Comment39773
Kenneth Colwell
Monday 12 July 2004 5:20:16 am
Hi all,
I created a quick temporary solution by using the following code as a cron. (uses pear db)
include("DB.php"); $dsn = array( 'phptype' => "mysql", 'hostspec' => "localhost", 'database' => "your-database-name", 'username' => "your-database-user", 'password' => "your-database-password" ); $db = DB::connect($dsn); if (PEAR::isError($db)) { echo "An error occurred while trying to connect to the database server.<br>\n"; echo "Error message: " . $db->getMessage() . "<br>\n"; echo "A more detailed error description: " . $db->getDebugInfo() . "<br>\n"; } $list = $db -> getAssoc ('SELECT * FROM `ezcontentobject` WHERE `contentclass_id` =12 and `section_id` = 0' ); var_dump($list); if (count($list) >= "1") { echo "\nfix in progress\n"; $res =& $db->query('update `ezcontentobject` set `section_id` = 3 WHERE `contentclass_id` =12 and `section_id` = 0'); if (DB::isError($res)) { die($res->getMessage()); } $list = $db -> getAssoc ('SELECT * FROM `ezcontentobject` WHERE `contentclass_id` =12 and `section_id` = 0' ); echo "\nfix completed\n"; var_dump($list); }
Hopefully someone can find a more elegant solution to my problem.
thanks,ken colwell