mmh se ho capito bene quello ke vuoi dire potresti utilizzare nella query LIKE
SELECT * FROM blabla WHERE data LIKE " . $data . " order by...
fammi sapere