My aim to send pushbullet notifications to users by using cron.
I have a mysql db and there are users table and issues table in it. I want to get all users from the users table after that create another query that bring issue count based on assigned user id from issues table. Finally make notifications.
Here are details and what i tried. Firstly; i tried to get user ids and it worked as expected.
function some_function($sa){
foreach($sa as $s)
echo $s;
}
$sqlText['id']="SELECT users.id,
users.login
FROM users
GROUP BY users.login";
$sqlQuery_MainMenu = mysql_db_query($db, $sqlText['id'], $connection) or die("Error");
$file_names=array();
while($mm_Content=mysql_fetch_array($sqlQuery_MainMenu)){
$users[]=$mm_Content["id"];
}
foreach ($users as $user) {
$foo=array($user);
some_function($foo);
}
Since i have user ids i tried to create new query that brings issue count based on user id. But i could not do it. I know what i want to do but i do not know how to do it.
$sqlText['push']="SELECT COUNT(*)
FROM issues INNER JOIN users ON issues.assigned_to_id = users.id where assigned_to_id = $s";
$sqlQuery_MainMenu = mysql_db_query($db, $sqlText['push'], $baglanti) or die("Error");
$users=array();
while($mm_Content=mysql_fetch_array($sqlQuery_MainMenu)){
$users[]=$mm_Content;
}
foreach($users as $index => $user){
//$attachment .= $directory.'/'.$files[$index].', '."'$file_names[$index]'";
echo $user[0] ;
}
Basically what i am trying to do is create a function that runs following line for each value that came from mysql.
$pb->Device('user.id from db')->pushLink("Some text", "http://some link", "issue count");