| 1 | <?php |
| 2 | //requiring main config file with path/database etc. constants |
| 3 | require('../config/config.inc'); |
| 4 | |
| 5 | //connecting to database and creating universal $db object |
| 6 | require(SYSTEM_ROOT.'/inc/log.inc'); |
| 7 | require(SYSTEM_ROOT.'/inc/database.inc'); |
| 8 | require(SYSTEM_ROOT.'/inc/nodes.inc'); |
| 9 | $db=new CLASS_DATABASE(); |
| 10 | $db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1"); |
| 11 | |
| 12 | |
| 13 | $q="select * from nodes where node_type='poll'"; |
| 14 | $set=$db->query($q); |
| 15 | |
| 16 | while ($set->next()) { |
| 17 | unset($options); |
| 18 | $node_id=$set->getString('node_id'); |
| 19 | $old_poll_id=$set->getString('old_id'); |
| 20 | $q="select * from poll_options where id_poll=$old_poll_id"; |
| 21 | $pollset=$db_old->query($q); |
| 22 | while ($pollset->next()) { |
| 23 | $pollset_array[]=array("text"=>$pollset->getString('text'),"number"=>$pollset->getString('number')); |
| 24 | } |
| 25 | $options=serialize($pollset_array); |
| 26 | $db->query("insert into node_content set node_id='$node_id',node_content='$options'"); |
| 27 | } |