I have a variable (var) in java.
I need to use the variable in a PHP file to interact with MySQL database.
How do I pass the var to use it as php variable?
(it just a word like "car" that I am passing - should not be difficult)
PHP always runs first, it's a preprocessor, after which the scripting on the page runs.
You will need to send the information either as a query string parameter, or as a POST to the PHP script.
It might be a good idea to describe your setup - browser, server, what files are being used on each. At the moment, any answer we gave you would be as good as any other, and quite likely all wrong anyway.