I am pretty sure this is an easy one, but I am lost and blind.
the query that works:
$result = mysqli_query($link, 'SELECT events.*, filestore.filename
FROM events
LEFT JOIN filestore ON events.id = filestore.event_id
ORDER BY events.startdate ASC LIMIT 0 , 30 ');
this outputs a row for every file, and outputs events for which no files are associated, almost what I want.
the query that doesn’t work :
$result = mysqli_query($link, 'SELECT events.*, GROUP_CONCAT(filestore.filename SEPARATOR ' ') as filenames FROM events
LEFT JOIN filestore ON events.id = filestore.event_id GROUP BY events.id ORDER BY events.startdate ASC
LIMIT 0 , 30 ');
This one works with PMA, returning one row for each event, even if no files for that event are in the db, with filenames concatenated in one field - but I never get a $result output from var_dump and weirdly am not getting an error from
if (!$result)
{
$error = 'Error fetching events: ' . mysqli_error($link);
include 'error.html.php';
exit();
}
Because the query I want to use works in mysql/PMA - I am posting in PHP
thanks