Reputation: 5105
I have a Laravel application where I have two PHP files, one of which is basically a wrapper with text lines and a call to a function in the other file.
When I go into powershell and run php refresh.php
, it runs the below file but only prints out the lines, it doesn't execute the classes function, it only prints the lines out.
How can I run this refresh file so that it properly executes the refresh function in Q_Temp.php
?
Refresh.php
<? php require_once ('Q_temp.php');
echo "start \n\n";
echo Q::refresh();
echo "\n done \n";
?>
Q_temp.php
Class Q {
function refresh()
{
$sql = "select C, S, P, Q FROM tbl1";
$result_set = Iseries::runQuery_simple($sql);
$log = "";
foreach ($rr as $row) {
$log .= "EXECUTING: $sql -- ";
$res = $this->add_new($row['S'], $row['P'], $row['Q'], $row['C']);
$log .= "$res \n";
}
return $log;
}
}
Upvotes: 0
Views: 80
Reputation: 12131
$rr
in your foreach
loop is undefined.
It should be something like this:
Class Q {
static function refresh()
{
$sql = "select C, S, P, Q FROM tbl1";
$result_set = Iseries::runQuery_simple($sql);
$log = "";
foreach ($result_set as $row) {
$log .= "EXECUTING: $sql -- ";
$res = $this->add_new($row['S'], $row['P'], $row['Q'], $row['C']);
$log .= "$res \n";
}
return $log;
}
}
Upvotes: 1