Quote:
Originally Posted by kh99
Hmm, I'm not sure I completely understand. But anyway, you could do something like this:
Code:
$msgs = $db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . " pmtext");
while ($check = $db->fetch_array($msgs))
{
if (($touser=@unserialize($check['touserarray'])) !== FALSE)
{
// check $touser[]
}
}
to be honest I don't know how to do the "check $touser[]" part. From your example it looks like $touser['cc'] would be an array of cc'd users, like (1=>admin, 8=>soso}. But does that mean the touserarray only contains the users who were cc'd? I don't know.
|
hey ,
i get something , it's working good to get all user-id or usernames from touserarray
and than you can make check
Code:
global $db ,$vbulletin;
$touser = array();
$sql = $db->query_read("SELECT touserarray FROM " . TABLE_PREFIX . "pmtext where pmtextid = 149");
while ($sql1 = $db->fetch_array($sql))
{
$touser = unserialize($sql1['touserarray']);
foreach($touser AS $key => $item)
{
if (is_array($item))
{
foreach($item AS $subkey => $subitem)
{
$username = $subitem;
$userid = $subkey;
# store the data as $user_arr[$id] = $name
$user_arr[$subkey] = $subitem;
}
}
else
{
$username = $item;
$userid = $key[$i];
$user_arr[$key[$i]] = $item;
}
# store the data as $user_arr[$id] = $name
$user_arr[$userid] = $username;
# or if you just want to print off the data during the loop...
echo "ID: $userid; name: $username" . PHP_EOL;
}
// LOOP
foreach ($user_arr as $k => $v)
{
// var to all user-id you can use&print it in templates $all_userid
$all_userid .= $k . PHP_EOL;
// OR you can print all user-id on this loop
echo $k ;
// OR you can user&print all user-id by array
$all_userid[] = $k . PHP_EOL;
}
// print the array
print_r ($all_userid);
}
your code is very simple ,I would like to used a small code
but i don't understand this part
Code:
if (($touser=@unserialize($check['touserarray'])) !== FALSE)
{
// check $touser[]
}