Is there a way to create an array from multiple arrays?
Here , I have to query 2 different tables and get data from a field.
The code :
$users_list = $this->db->query_fetch_assoc("SELECT player FROM friend_list WHERE owner = '$g_member_id' AND mutual = '1'");
$users_list = $this->db->query_fetch_assoc("SELECT members FROM alliance WHERE members = '$thisusername'");
$users_list = explode(';',$msg_to);
After , I have this :
foreach($users_list as $users){
The code above should make an array from the 3 different array , then it should be an array that can be used for foreach.
Above is all my code. This code is used in a mail system. If user type * in 'to' field , this sends the message to everybody in a certain table.
If he type fl , it does same thing , but for another table.
Also , I would like to makes it possible to use ; to separate users , while including different option 'send to all' like the fl and *.
The full code is :
if(strstr($msg_to, '*')){
$thisusername = $this->get_username_from_id($g_member_id);
$users_list = $this->db->query_fetch_assoc("SELECT members FROM alliance WHERE members = '$thisusername'");
$users_list = explode(';',$msg_to);
}
elseif(strstr($msg_to, 'fl'))
{
$users_list = $this->db->query_fetch_assoc("SELECT player FROM friend_list WHERE owner = '$g_member_id' AND mutual = '1'");
$users_list = explode(';',$msg_to);
}
elseif(strstr($msg_to, 'all'))
{
$users_list = $this->db->query_fetch_assoc("SELECT members FROM alliance WHERE members = '$thisusername'");
$users_list = $this->db->query_fetch_assoc("SELECT player FROM friend_list WHERE owner = '$g_member_id' AND mutual = '1'");
$users_list = explode(';',$msg_to);
}
foreach($users_list as $users){
....
Here , I have to query 2 different tables and get data from a field.
The code :
$users_list = $this->db->query_fetch_assoc("SELECT player FROM friend_list WHERE owner = '$g_member_id' AND mutual = '1'");
$users_list = $this->db->query_fetch_assoc("SELECT members FROM alliance WHERE members = '$thisusername'");
$users_list = explode(';',$msg_to);
After , I have this :
foreach($users_list as $users){
The code above should make an array from the 3 different array , then it should be an array that can be used for foreach.
Above is all my code. This code is used in a mail system. If user type * in 'to' field , this sends the message to everybody in a certain table.
If he type fl , it does same thing , but for another table.
Also , I would like to makes it possible to use ; to separate users , while including different option 'send to all' like the fl and *.
The full code is :
if(strstr($msg_to, '*')){
$thisusername = $this->get_username_from_id($g_member_id);
$users_list = $this->db->query_fetch_assoc("SELECT members FROM alliance WHERE members = '$thisusername'");
$users_list = explode(';',$msg_to);
}
elseif(strstr($msg_to, 'fl'))
{
$users_list = $this->db->query_fetch_assoc("SELECT player FROM friend_list WHERE owner = '$g_member_id' AND mutual = '1'");
$users_list = explode(';',$msg_to);
}
elseif(strstr($msg_to, 'all'))
{
$users_list = $this->db->query_fetch_assoc("SELECT members FROM alliance WHERE members = '$thisusername'");
$users_list = $this->db->query_fetch_assoc("SELECT player FROM friend_list WHERE owner = '$g_member_id' AND mutual = '1'");
$users_list = explode(';',$msg_to);
}
foreach($users_list as $users){
....