# Displaying the errors from my BuddyPress script

I have a .csv file with hundreds of rows and 2 columns. First column is the group name, and the second is the group description. I need forum to be active on all of the groups.

I was told to use this code:

<?php

$groups = array(); if (($handle = fopen("groupData.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$group = array('group_id' => 'SOME ID', 'name' =>$data[0],
'description' => $data[1], 'slug' => groups_check_slug(sanitize_title(esc_attr($data[2]))),
'date_created' => gmdate( "Y-m-d H:i:s" ),
'status' => 'public'
);
$groups[] =$group;
}
fclose($handle); } foreach ($groups as $group) { groups_create_group($group);
}

?>


So I created a php file with this code and opened the file in the browser, and I got a blank screen. And it didn't create the groups.

I have no idea what to do from here. What should I do?

-

thanks for sharing your script with us. It's totally normal that this script results in a blank screen because it does not do any output.

So once you have requested it, it should have created the groups.

UPDATE:

If it did not create the groups, then the script failed. It's highly likely you've made an error. Ensure that you can see all errors, so check the error log or enable error displaying and reporting for that file. This is some runtime configuration for a starter:

ini_set('display_errors', true);
error_reporting(E_ALL);

-
Well, it didn't :(. –  Anders Jan 4 '11 at 18:26
From the error log: [04-Jan-2011 12:50:23] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-zts-20060613/ixed.5.2ts.lin' - /usr/local/lib/php/extensions/no-debug-zts-20060613/ixed.5.2ts.lin: undefined symbol: executor_globals_id in Unknown on line 0 –  Anders Jan 4 '11 at 18:52
It seems to be something wrong with my php.ini on my hosting. Thank you for your help @hakre. –  Anders Jan 4 '11 at 19:17
@Anders: Oh even a PHP startup error. But that one shouldn't prevent you executing in the end (but, yeah, fix it). Check the error reporting or add the two lines in my updated stuff to output warnings and notices for that script only while you call it. –  hakre Jan 4 '11 at 21:29
I don't get any errors now, but the script is still not creating the groups. –  Anders Jan 5 '11 at 1:56