I have seen lots of questions about this topic and all of them were asking whether someone, who wants to use PHP for "building web pages", should learn HTML first, or not?

Most of the answers said yes, because most of the time you make web page with both PHP and HTML (and maybe CSS).

However, if I just want to use PHP for contacting to My Database (for example MySQL) and nothing more, should I first learn any HTML or CSS, or not?

  • If you only want to interact on the command line you do not even need PHP. You can talk to your database directly and use a few shell functions (e.g. bash on Linux, Powershell on Windows etc.) to format and store the data. – Eike Pierstorff Jun 12 '14 at 8:30
  • not just that. actually I want to communicate from my android application to my mysql database, and php is going to do that for me I guess. – Sadegh Jun 12 '14 at 8:51

You can learn PHP without learning HTML / CSS.

If you are just doing simple database operations without making any web pages / web interface to your application, then PHP only is fine. So, you would be practically restricted to running PHP scripts via command line.


It's never bad to know the basics of HTML/CSS, but if you really just use it for database communication, I don't really see the need to learn it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.