I'm not going to explain to you how to connect to the MySQL server, get an instance of the database, and run an SQL query. There are plenty of tutorials for that. I'm going to help you with the query. For this purpose we will use the Pythagorean theorem. It's not the best approach because Earth in not flat, but I think it will work (not in middle of the Pacific where we pass from -180º to 180º, though)
"SELECT uid,regid, sqrt(latitude-".$users_latitude.")+sqrt(longitude-".user_longitude.") AS SQRT_DIST
FROM GPS_tbl ORDER BY SQRT_DIST LIMIT 1;
This is how you will get the closest point.
Note that the returned distance is distance^2.