hey guys, how can i excute this query for a while loop only if a certain sort order is selected? i get a parse error, any way around this? thanks!
if ($order_by == 'call_number') {
$print_calls_sql4 = "SELECT *, DATE_FORMAT(Date_time, '%c/%d/%y %l:%i%p') AS NDate FROM current_calls";
if ($workers) {
if (is_user($workers)) {
$print_calls_sql4 .= " WHERE ID LIKE '$workers,%' OR ID LIKE '%,$workers,%'";
}
}
}
else {
if ($workers) {
if (is_user($workers)) {
$print_calls_sql4 = "SELECT id FROM phpuserlogin_users WHERE id='$workers'";
}
} else {
$print_calls_sql4 = 'SELECT id FROM phpuserlogin_users';
}
}
$print_calls_sql4 .= " $order_by_str $sort_order_str";
$print_calls_query4 = mysql_query($print_calls_sql4, $link_id);
$counter = 0;
while ($result_print_calls_query4 = mysql_fetch_array($print_calls_query4)) {
$link_data = "sort_order=$org_sort_order&order_by=$order_by&workers=$workers&anchor=Anchor $counter&call_or_task_id=$result_print_calls_query4[CID]";
if ($order_by != 'call_number') {//execute query and start a while loop
$query = mysql_query("SELECT *, DATE_FORMAT(Date_time, '%c/%d/%y %l:%i%p') AS NDate FROM current_calls WHERE ID LIKE '$result_print_calls_query4[id],%' OR ID LIKE '%,$result_print_calls_query4[id],%'", $link_id);
while ($result = mysql_fetch_array($query)) {//here is the problem
}
//print data here
if ($order_by != 'call_number') {//end the created while loop
}
}
}