[SELECT * FROM ost_ticket WHERE staff_id <> "0" AND 3 >= TIMESTAMPDIFF(DAY,created,NOW()) AND status = "open" and staff_id = <?=$rowtotalstaff['staff_id']?>]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?=$rowtotalstaff['staff_id']?>' at line 1