function retrieveAndPrintAllFromTable($table) { $conn = connectToDatabase(); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $queryAllColumns = "SELECT distinct Column_name FROM Information_schema.columns WHERE Table_name LIKE '{$table}';"; $allColumns = $conn->query($queryAllColumns); createTableOnWebpage($allColumns); $conn->close(); }
function retrieveAndPrintAllFromTable($tableName, $id_column, $rowid) { $conn = connectToDatabase(); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $queryAllColumns = "SELECT distinct Column_name FROM Information_schema.columns WHERE Table_name LIKE '{$tableName}';"; $allColumns = $conn->query($queryAllColumns); $queryToGetAllDataOfATable = "SELECT * FROM {$tableName} WHERE {$id_column} = {$rowid}"; $result = $conn->query($queryToGetAllDataOfATable); createTableOnWebpage($allColumns, $result); $conn->close(); }