User’s details in the Header section

Re: User’s details in the Header section

by Mik O'Leary -
Number of replies: 0

I use a CONCAT statement to combine info then use UNION to join that header row to the rest of the query.

e.g.


SELECT CONCAT(usub.lastname,", ",usub.firstname,  "  ||  Last login was ",  (IF (usub.lastaccess = 0,"never",DATE_FORMAT(FROM_UNIXTIME(usub.lastaccess),'%Y-%m-%d'))),  "  ||  [Student# ",

                                usub.idnumber,  "] " ) AS 'assessment_title'

FROM prefix_user AS usub

WHERE usub.id - %%USERID%% -- shows details only for currently logged in student


UNION

   SELECT (insert query to give list of courses for this student)

   WHERE usub.id - %%USERID%% -- shows details only for currently logged in student