Answer the question
In order to leave comments, you need to log in
How to delete a row from the WordPress database on click on a link?
There is a code that displays the values from the table, but how to make it possible to delete this row by clicking on the button? So that there is a "DELETE" button opposite each line, and by clicking on it, this line is deleted from the database.
<?php
$db1 = new PDO('mysql:host=localhost;dbname=************', '************', '************');
$db1->query("SET NAMES 'utf8'");
$stmt = $db1->query("SELECT * FROM `tetris` ORDER BY `score` DESC LIMIT 10");
$a = array();
foreach($stmt->fetchAll() as $row){
$tmp = array();
$tmp['_id'] = $row['id'];
$tmp['name'] = $row['name'];
$tmp['email'] = $row['email'];
$tmp['score'] = $row['score'];
$tmp['lines'] = $row['lines'];
$tmp['level'] = $row['level'];
$tmp['created_at'] = $row['date'];
$a[] = $tmp;
}
echo json_encode($a);
$db1 = null;
?>
Answer the question
In order to leave comments, you need to log in
Are these addresses in the html code as links? If there is, then:wget -r https://site.ru
Judging by the format of the links, the site is dynamic, that is, the pages are determined by parameters such as page=3.
Most likely PHP.
Therefore, you can download pages (for example, wget), but most likely something will not work correctly.
You need sources, not generated pages. You can get them for example via FTP. But your hoster doesn't seem to let you do that.
And besides the files, there may also be a database, without which the site may not start
In short:
Make up a button --> Attach a handler to it, which will send a pointer to the data to be deleted on click --> Catch this data on the back and write a delete request to the database .
If in more detail:
You are freelancing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question