Below is the query to find total tickets of a person. fWork is that person's ID. What is the best way to put the variable inside the condition?
Should I declare something like $ID = $_GET['ID'];
and it becomes fWork = $ID
or fWork = ?
, and put $_GET[ID]
in the parameter like this array($_GET['ID'])
$open_count = " SELECT * FROM TicketO WHERE Assigned = 0 AND fWork = 983";
$query = sqlsrv_query($NEI,$open_count, array(), array( "Scrollable" => 'buffered' ));
$open_tickets_count = sqlsrv_num_rows($query);
echo " open tickets: " . $open_tickets_count;
Also, I am having trouble including UNION ALL in the query, am i missing some parentheses? It returns false.
$total_count = "SELECT * FROM TicketO WHERE fWork = '983'
UNION ALL
SELECT * FROM TicketD WHERE fWork = '983'";