1

by using SSI.php i am accessing user's list of forums. suppose i have 3 registered users in my forums user1, user2, user3

require('SSI.php'); 
global $context, $settings, $options, $scripturl, $txt;
file_get_contents($context);

$username = $context['user']['name'];

in my php code i am using those user names to get information via api url.

$api = "hxxps://apiurl/?account_id=$username";
$json = file_get_contents($api);
$array = json_decode($json, true);

here i am retriving some data from api.

$data1 = $array[data1];
$data2 = $array[data2];

for now i am doing below task individually for every member from specific group in Simple Machine Forums.

include 'config.php';

$query = mysql_query("SELECT username FROM table1 WHERE username=$username", $con);
            if (mysql_num_rows($query) != 0){
                    mysql_query("INSERT INTO my inset query)") or die (mysql_error());

                    echo "User's New Record added<br> ";
            }

my question is how can i automatically update all members record by giving it a list of array which contains all usernames and how can i create corn job that this specific php file run automatically after every 24 hours. i am using mysql i have seen around mysql is not safe but as i am just beginner please ignore my mistakes i am trying to understand basics.

code83
  • 21
  • 1
  • 6
  • Get rid of `mysql_*` functions. Now. Please. Use PDO. To answer your question, you could write an SQL query to `SELECT username FROM tbl WHERE account_id IN (1, 123, 155, 664, 234, 342)` – Rob W Mar 20 '15 at 00:28
  • thanks for reply, i am looking for loop which in which i can grab data from a specific api url for each username then insert into database and go back to 2nd username. – code83 Mar 20 '15 at 00:35

0 Answers0