I have a list of table names in my $_POST
variable and I am trying to feed them into a MySQL query. My ultimate goal is to be able to select what tables I want to pull data from one page and then be able to use that data. Everything is accurate and working in my $_POST variable, I just don't know how to pass that onto the query string.
Using the code below, I'm not getting any results back at all. I'm fairly new and completely pulling my hair out. Any help would be greatly appreciated, even if it is just a point in the right direction.
foreach ($_POST as $item) {
if ($item != 'Submit') {
$query = "SELECT * FROM " . $item;
$result = $database->query($query);
$$item = mysqli_fetch_array($result);
}
}