Forum Moderators: coopster

Message Too Old, No Replies

Help adding arrarys?

         

BlackRaven

7:07 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



hi, ok i am try to add my two $ignored_ids values, but i dont know how? As it stands now the first $ignored_ids is replaced with the second $ignored_ids arrary? any help? Thanks

$sql = "SELECT ignored_id FROM " . IGNORE_TABLE . " WHERE user_id = " . $userdata[user_id];
if (!($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error retrieving ignore user data', '', __LINE__, __FILE__, $sql);
}
$ignored_ids = array();
while( $row = $db->sql_fetchrow($result) )
{
$ignored_ids[$row['ignored_id']] = true;
}

$sql = "SELECT user_id FROM " . IGNORE_TABLE . " WHERE ignored_id = " . $userdata[user_id];
if (!($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error retrieving ignore user data', '', __LINE__, __FILE__, $sql);
}
$ignored_ids = array();
while( $row = $db->sql_fetchrow($result) )
{
$ignored_ids[$row['user_id']] = true;
}

ChadSEO

8:04 pm on Aug 2, 2005 (gmt 0)

10+ Year Member



The line "$ignored_ids = array();" is clearing the array. Take out the second occurance of that line, and I think it will do what you want it to.