mysql - php: Execute php file from another php file with parameters -


details: have php file runs sql , retrieve list of information. run through loop of information , want call php page , pass parameters data looping through.

question: how execute php page within php?

what have tried: php code should calling second php page (the while loop should calling simplepush.php page each result get):

<?php require_once "../database/config.php"; header("content-type: application/json"); $sql = "select user_ip_address ft_users"; $res = mssql_query($sql); if (mssql_num_rows($res)) {      while ($op = mssql_fetch_assoc($res)) {         exec('simplepush.php?token = ' . $op . '');         $arr[] = $op;     }      echo json_encode($arr);      //$op = mssql_fetch_assoc($res);     //$op['response'] = 200; } else {     http_response_code(420);     $op = array(         'response' => 420     );     echo json_encode($op); }  mssql_close(); ?> 

i have tried following:

include ('simplepush.php?token = '.$op.''); exec ('simplepush.php?token = '.$op.''); require ('simplepush.php?token = '.$op.''); shell_exec ('simplepush.php?token = '.$op.''); 

just do:

include ('simplepush.php'); 

now $op available in simplepush.php. consider example:

//index.php while ($op = mssql_fetch_assoc($res)) {     include ('simplepush.php');     $arr[] = $op; }  //simplepush.php print_r($op); 

the contents of $op output each time through loop.


Comments