M
M
Mikhail Maximov2019-01-28 11:29:20
PHP
Mikhail Maximov, 2019-01-28 11:29:20

How to output MySQL table to html table?

Site on the Joomla engine with registries of organizations - members. Initially, an XLS file is formed, which is converted to html and sql and loaded further through the form in the admin panel. Through sql, as I understand it, a search in the registry is implemented. The html file is displayed on the full registry page, but it does it extremely crookedly, and downloading it twice is a waste of time. I would like to know how you can write code on the full registry page so that it pulls all the data from the MySQL table.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kovalev, 2019-01-28
@PriestFromRL

Link to a possible answer
I looked for an answer on several forums, and almost everywhere they write that this makes no sense and cannot be implemented in any way. In theory, this can be done, but using PHP without a table. And on a straight line in html the table in any way.

S
Sergey Pliskin, 2019-06-27
@pligin

Simple version in PHP

$result = mysqli_query("SELECT * FROM `table` ORDER BY `id` DESC LIMIT 15");
if(mysqli_num_rows($result) > 0){
    echo '<table><tr><td>ID</td><td>DATA</td></tr>';
    while($data = mysqli_fetch_array($result)){
        echo '<tr><td>'.$data['id'].'</td><td>'.$data['data'].'</td></tr>';
    }
    echo '</table>';
}else{
    echo 'Ничего нет (';
}

In HTML, you can also use JS to shove data that can be obtained from a PHP file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question