PHP reports – Functions and Logic – Query Formation – All

Once the strings of conditions are collected (code snippet above shows how the conditions are formed), we can frame the query for the report.

 

e.g.: $query_Recordset1 = “SELECT fr.CREW,

fr.CRAFT,

fr.WO_NUMBER, FR.DESCRIPTION WO_DESC,

fr.WO_STATUS, FR.MAINT_TYPE,

fr.PRIORITY,

fr.EQUIPMENT,

fr.ASSIGNED_TO,

fr.START_DATE, FR.DUE_DATE,

fr.DESCRIPTION BUILDING

FROM FAMIS_REQ fr

INNER JOIN FAMIS_BUILDING fb ON fr.building = fb.building

WHERE  ” . $limit . “

 ” . $sqlmaint . “

” . $sqlcrews . “

” . $sqlcraft . “

” . $sqlstatus . “

” . $sqldates . “

ORDER BY fr.CREW, fr.WO_STATUS, fr.CRAFT”;