I want to make a constructor to query the database from jQuery using POST and passing the parameters collected from the quarry.
The difficulty is that we need to transfer from SELECT * FROM engagements WHERE clause as a string, and as such refuses to work.
//method passes a string to the backend
that.ReportList("SELECT * FROM engagements WHERE eng_visitor_type='Metro North HHS Staff'");
$sql_list = $_POST['sql_list'];
//Here problem occurs
$query = "$sql_list //SELECT * FROM engagements WHERE eng_visitor_type='Metro North HHS Staff'
AND ( eng_datetime BETWEEN '$date_start' AND '$date_finish' )
AND ( team='$IHLO' OR team='$ADULTSH' OR team='$IPJ' OR team='$ISD' )";
$mysqli = new mysqli($localhost, $username, $password, $database);
$success = $mysqli->query($query);
Tell me how to solve this?