A variable is passed each time you click a link and on the new page this variable is used to identify the table in which the data (which you enter on the new page) will be stored. How to use this PHP variable inside a mysql prepared statement?
This works (when I explicitly define the table name in the code):
$stmt1 = $conn->prepare("INSERT INTO tableName (comment)
VALUES (?)");
This doesn't (when the table name is contained within a PHP variable):
$stmt1 = $conn->prepare("INSERT INTO '$phpVar' (comment)
VALUES (?)");
How to make the second variant work since the first one only works for one table while the table needs to change everytime you click a different link. It must be noted that when I echo the variable on the page it echoes the exact name of the table (the exact value that should be in the prepared statement).