i am calling python file to be executed from php this is my script:
$sql = "INSERT INTO info (num_pause, duration, tot_time, time_arr,sess_id)
VALUES ('$num_pause', '$tot_time','$duration','$time_arr','$sess')";
if ($conn->query($sql) === TRUE) {
// echo "New record created successfully";
mysqli_close($conn);
$result = exec("python db_Conn.py
C:/xampp/htdocs/Ai_Edutech_trial_project/eclipse_workspace/Project");
echo $result;
$result_array = json_decode($result);
foreach ($result_array as $row) {
echo $row."<BR>";
}
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
the $sql is working fine but ..there is an error at $result line:
Parse error: syntax error, unexpected 'echo' (T_ECHO) in
C:\xampp\htdocs\Ai_Edutech_trial_project\Php_file\vid1\my_parse_file_one.php
on line 44
its showing error in
echo $result
even if everything is fine... can someone suggest if there is any error in path
` glue instead of looping. Lastly, I recommend tabbing your code properly and writing your executable script on one line. – mickmackusa Apr 15 '18 at 00:13