Can I use MySQL with JavaScript

Display certain data from an SQL database with Javascript

Hi guys

First of all, I'm a beginner in web design (i.e. html5, sql, php, javascript).

In order to practice and tinker around a bit, I set up a personal link list. I already have a page in which I can enter the link in a MySQL database. I also have a page on which I can display the links. I can simply search for specific links through a search field. Everything works out fine.

But now I would like a drop-down list in which all rubrics are listed and when you select a rubric, all links from this rubric should be inserted directly below it. So a live change of the page, without the OK must be pressed and the page has to be reloaded, as it would normally be, for example. submits a form. Of course I'm not sure if this is possible, but I think if it is, then with javascript.

I already have the first part. All categories are taken from the database and displayed in a drop-down list:

  1. // Show all categories
  2. $ query_rubriken = "SELECT DISTINCT rubric FROM webpages";
  3. $ r = $ pdo-> query ($ query_rubriken);
  4. echo " \ n";
  5. ?>
Show all

I've already found the following. This enables me to display the rubric in a predefined area. But how do I get the links that are stored under the heading in the database?

  1.         <div id="show" class="show"></div>
  2. <script type="text/javascript">
  3. var rubric = document.getElementById ('rubric');
  4. rubrik.onchange = function () {
  5. var show = document.getElementById ('show');
  6. show.innerHTML = this.value;
  7. }
  8. </script>

Can somebody help me?