For a web application you need both.
Best way to learn is trying to create a simple app. Consider a very simple address book app. You need to store the entries (so you need MySQL for instance).
Actually you need to be able to perform 4 basic actions with the data which is called CRUD - Create, Read, Update, and Delete. For this you need to use a language like PHP, ASP, Python, which run on your server.
To actually use the app you need a user interface which is created by HTML + JS (or jQuery) + CSS and possibly you'd also use some images.