PHPSpreadsheet not getting data from SQL Query?

You mean split it into separate columns for surname and first name? If there’s a rule, then you could do it as a query or a short bit of PHP code. For example if the format is always surname, followed by a comma, followed by the first name, then you could write a short bit of PHP to read every row, split the names, and write it back. There may be a way to do that in a query, ask in the “Databases” area as that wouldn’t be PHP related.

Either your WHERE condition is not finding any rows that have present = 1, or your INNER JOIN cannot match the two fields. Keep in mind that an INNER JOIN will only return rows where there is a match in both tables, so if you have managed to get a value in attendance.member_id that does not exist anywhere in your members table in the name column, you won’t get that row returned. This is why I queried whether you shouldn’t be matching to members.id (which I still think you should be doing, as I said elsewhere at length).

It’s very difficult to guess why it’s returning nothing without seeing your data, especially given the confusing column names. You could blur some of it if you are concerned about privacy issues, as long as you leave enough to actually diagnose with.

That would seem like a case for removing the index, renaming the column and then reinstating the index, but I am not a database expert by any means, and there may be more to it.

1 Like