simplysandeep Posted November 18, 2011 Share Posted November 18, 2011 Hi everyone. I've two MySQL tables (tbl_csv_input & tbl_qn_types). Table Details: 1. tbl_csv_input (qid, qname, qn_answer, qn_type) Primary Key = qid; Foreign Key = qn_type ref tbl_qn_types qn_type_id 2. tbl_qn_types (qn_type_id, qn_type_name, notes) Primary Key = qn_type_id Sample Data: tbl_csv_input 1 ; Ferrari is the fastest car? ; Yes||No ; T1 2 ; Which below features would you like to have in you... ; Navigator||Airbag||Seat Belt||Camera & Sensors ; T1 3 ; Which model would you prefer? ; CX||MX||SX||LX ; T2 4 ; Comments ; ; T3 tbl_qn_types T1; checkbox; This qn type is used for yes/no T2; radio; Multiple options but only one is correct T3; text area; Users enter input like comments The whole idea is to have a questionnaire displayed in a HTML table depending upon the question types (T1, T2, T3) In simple terms: You have a question and below it there are options. Some questions have check boxes and some have radio buttons and some have text areas. The problem I'm facing is with the column: qn_answer; and column = qn_type. I'm unable to make a loop inside a table which is already in a loop. Please see the attached files (which has the code I've written). TIA. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/251360-fixing-code-html-table-php-mysql/ Share on other sites More sharing options...
RussellReal Posted November 18, 2011 Share Posted November 18, 2011 you are probably not increasing X in the loop.. try this instead: foreach ($array as $value) { echo "$value<br />"; } Link to comment https://forums.phpfreaks.com/topic/251360-fixing-code-html-table-php-mysql/#findComment-1289216 Share on other sites More sharing options...
simplysandeep Posted November 18, 2011 Author Share Posted November 18, 2011 Thanks Russell. It was helpful. Link to comment https://forums.phpfreaks.com/topic/251360-fixing-code-html-table-php-mysql/#findComment-1289304 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.