如何在 PHP 中使用单击元素的内部 HTML,如下所述?
$(function () {
$(".topic-list-items").click(function () {
// document.getElementById("content-of-the-topic").innerHTML= $(this).context.innerHTML;
<?php
$dbhost = '127.0.0.1';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
die('Could not connect: '.mysql_error());
}
// here I want to table name dynamically, that is, "SELECT id FROM table". $variable
$sql = "SELECT id FROM ";
//$ variable is the clicked element's innerHTML
mysql_select_db('entries_database');
$retval = mysql_query($sql, $conn);
if (!$retval) {
die('Could not get data: '.mysql_error());
}
?>
});
});