I have following SQL query:
SELECT tbltasks.fldTaskNr
,tbltasks.fldRITMNr
,tbltasks.fldCHGNr
,tblci.fldCI
,tblgxp.fldGxP
,tblrequester.fldRequester
,tblstatus.fldStatus
,tbltasks.fldDescription
,tblresponsible.fldResponsible
,tbllocation.fldLocation
FROM tbltasks
LEFT JOIN tblCI ON tblci.pkCI = tbltasks.fkCI
LEFT JOIN tblgxp ON tblgxp.pkGxP = tbltasks.fkGxP
LEFT JOIN tblrequester ON tblrequester.pkRequester = tbltasks.fkRequester
LEFT JOIN tblstatus ON tblstatus.pkStatus = tbltasks.fkStatus
LEFT JOIN tblresponsible ON tblresponsible.pkResponsible = tbltasks.fkResponsible
LEFT JOIN tbllocation ON tbllocation.pkLocation = tbltasks.fkLocation
Now I want to store the values of this query and output them as a table, should look like this:
I got the following table as HTML, the output should show in this table and repeat itself as there will be several entries in the database:
<th>Task Nr.</th>
<th>RITM Nr.</th>
<th>CHG Nr.</th>
<th>CI</th>
<th>GxP</th>
<th>Task Requester</th>
<th>Task Status</th>
<th>Description</th>
<th>Responsible</th>
<th style="width: 201px;">Location</th>
</tr>
How can I do that? Any help is appreciated!
2
Answers
You can print the data you pulled into html with foearch.
}
You can get the result you want by applying the above code to your own table and data.
It’s easy but process is little bit long.
First make sure to give your query column an name value as follow:
Then use this code to convert your query into a array of object
Once this step is done then we can move on to your HTML Table part
Hope this will solve your problem, and make sure your file extension is ".php"