Showing mysql rows content in html table using php

im new here and i have a question, i looked for the solution everywhere and i still cant manage to solve this.

I want to show the results of the SELECT statement (in php) in a table (html) using JS. Here is the code of these 3 files:

HTML file

    <meta charset="UTF-8"/>
    <script src="C:UsersMarianoDesktopjsonmasmasmasdatos.js"></script>
    <script src="select.js" type="text"javascript"></script>
<button id="button"> Mostrar </button>
<input type="text" id="id" />
<div id="content"></div>

PHP file

$link=mysqli_connect("", "user_tienda","A*7I8qpg5","pool_tiendas");

if (mysqli_connect_errno() )
    echo "Fallo en la conexion con mysql" .mysqli_connect_error();

if ($action=="showroom") {
    $query = "SELECT cod, nmbre, drccn from tienda";
    $show = mysqli_query($link, $query) or die ("error");
    echo "<table border='2px'><tr><td>cod</td><td>nmbre</td><td>drccn</td</tr>";
    while ($row = mysqli_fetch_array($show)) {

        echo "<tr><td>" .$row['cod']."</td><td>".$row['nmbre']."</td><td>".$row['drccn']."</td></tr>";
    echo "</table>";

JS file

    $("#button").click(function () {

        function show_all() {
                type: "POST",
                url: "select.php",
                success: function (data) {


The problem is when i click the button to show the content nothing happens.

need some help from you ! Thanks for reading!

*The Select statemnt is correct, in Mysql font i can see the results of the SELECT statement.

*I also checked the mozilla “console” but nothing appears there

*Sorry for my bad english if its bad 😉

Source: mysql

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.