You are no clearer now 😕
obrienkev wrote:The same field names are in each table. The user has the choice to delete any file from each table.
'field names' ?? Sure you don't mean COLUMN names. 😃
I'm sure you do.
obrienkev wrote:
I want to display all the files in each database table. Then the user checks each one to delete.
How would I do this??
To get the contents/data from each table, you use the UNION query with the additional 'tbl' column so that each row in the result can be linked back to the table it is in
$query = "SELECT 'mergers' AS tbl, name FROM mergers ".
"UNION SELECT 'rights' AS tbl, name FROM rights ".
"UNION SELECT 'spin_offs' AS tbl, name FROM spin_offs ".
"UNION SELECT 'splits' AS tbl, name FROM splits";
Now you will have a set of results that looks like this
tbl, name
'mergers', 'file1'
'mergers', 'file2'
'rights', 'file3'
'rights', 'file4'
etc
Then when the user selects 'file2' or 'file3' you know which tables to delete each from.
Now, my guess is that you want to process multiple selections, and that will mean multiple queries. Yes, mysql can handle multi-table deletes (in some versions), but this is not a case for that. Multiple table deletes are for deleting related records from several tables at the same time, and involve the use of JOINS. That is not what we have here so using such a query would be complex overkill.
Just query each table seperately and display the data for each table in a seperate html table and/or form. Then process each submit seperately for each table.