Jump to content

Using PHP and SQL to populate array(s) potentially using a loop based on a table value


Dezzy217

Recommended Posts

I'm wondering how to populate array(s) with data retrieved from an SQL database and outputting this into a HTML table.

 

 

I'm using the following table structure

 

 

CREATE TABLE PROJECT_RECORDS (

RECORDS_ROWID number(3) not null,

RECORDS_LISTCOLUMNID number (3) not null,

RECORDS_RECORDVALUE varchar2 (25),

constraint PROJECT_RECORDS primary key(RECORDS_ROWID, RECORDS_LISTCOLUMNID));

Sample Data

 

 

RECORDS_ROWID RECORDS_LISTCOLUMNID RECORDS_RECORDVALUE     

------------- -------------------- --------------------

        1                    1     First Row                    

        1                    2     First Row Description    

        1                    3     First Row Date        

        2                    1     Second Row                      

        2                    2     Second Row Description          

        2                    3     Second Row Date  

        3                    1     Third Row  

        3                    2     Third Row Description   

        3                    3     Third Row Date  

 

 

From this I want to populate a html table e.g.

 

 

Column 1        Column 2                  Column 3

 

 - First Row    - First Row Description   - First Row Data

 

 - Second Row   - Second Row Description  - Second Row Date

 

 - Third Row    - Third Row Description   - Third Row Date

 

 

 

I'm wanting to retrieve the data based on the ROWID and then input into an Array (might require a loop) before starting the echoing this out into the table to the desired output.

 

 

Any help would be greatly appreciated.

Edited by Dezzy217
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.