Simple Machines Community Forum

SMF Support => Converting to SMF => IPB => Topic started by: raylu on February 22, 2011, 07:20:20 PM

Title: Converting polls from IPB 2.3.6 to SMF 1.1.13
Post by: raylu on February 22, 2011, 07:20:20 PM
I had an error converting poll options. The error was a MySQL error about the number of columns not being equal to the number of values passed in one of the rows. I inspected the row and it was indeed the case. I don't know what caused it, but I stepped around it by requiring $choice have 2 elements in invision2_to_smf.sql

/******************************************************************************/
--- Converting poll options...
/******************************************************************************/

---* {$to_prefix}poll_choices
---{
$no_add = true;
$keys = array('ID_POLL', 'ID_CHOICE', 'label', 'votes');

$choices = @unserialize(stripslashes($row['choices']));

if (is_array($choices))
        foreach ($choices as $choice)
        {
                if (count($choice) == 2) {
                        $choice = addslashes_recursive($choice);
                        $rows[] = "$row[ID_POLL], SUBSTRING('" . implode("', 1, 255), SUBSTRING('", $choice) . "', 1, 255)";
                }
        }
---}
SELECT pid AS ID_POLL, choices
FROM {$from_prefix}polls;
---*


EDIT: Actually, I think I was using the 2.0.x converter (which is labeled the Invision 2 converter; perhaps this should be changed). I grabbed the 2.3.x converter off the forums and it worked without modification.