Jump to content

thatsme2

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

thatsme2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks Barand, Your code is working perfectly. I want to display test_names along with test_id modified code, //added test_name $sql = "SELECT tr.member_id, tr.test_id, tr.test_score, t.test_name FROM test_results tr, tests t WHERE tr.test_id=t.test_id ORDER BY test_id"; $res = mysql_query($sql); $prevt = 0; $scores = $initial; while (list($mid, $tid, $score, $test_name) = mysql_fetch_row($res))//Added $test_name { if ($prevt != $tid) { if ($prevt != 0) { echo "<tr><th>TEST $prevt $test_name</th><td>" . join ('</td><td>', $scores) . '</td></tr>';//added test_name } $prevt = $tid; $scores = $initial; } // store results $scores[$mid] = $score; } echo "<tr><th>TEST $prevt $test_name</th><td>" . join ('</td><td>', $scores) . '</td></tr>'; //added test_name ?> I am getting only one test_name displayed. Thanks
  2. i am getting error, Parse error: parse error, unexpected '[', expecting ']' in D:\Practice\member_details.php on line 106 line 106 is, echo "<td>$test_results[$members[$val]['member_id']][1]['test_score']</td>
  3. Hi, I am trying for the past few days in various ways to solve the below problem. Please give me a solution. I have a the following db tables member_table test_results member_table structure member_id (pk) auto inc member_fname member_lname member_test_taken_flag test_results structure test_results_id(pk) auto inc member_id(fk) test_id test_score I have to display the above data in the format, <table border='1'> <tr> <td>Members</td> <td>Member1</td> <td>Member2</td> <td>Member3</td> <td>Member4</td> <td>Membern</td> </tr> <tr> <td>Tests</td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>test1</td> <td>member1score</td> <td>member2score</td> <td>member3score</td> <td>member4score</td> <td>membernscore</td> </tr> <tr> <td>test2</td> <td>member1score</td> <td>member2score</td> <td>member3score</td> <td>member4score</td> <td>membernscore</td> </tr> <tr> <td>test3</td> <td>member1score</td> <td>member2score</td> <td>member3score</td> <td>Not taken</td> <td>membernscore</td> </tr> <tr> <td>test4</td> <td>member1score</td> <td>Not taken</td> <td>member3score</td> <td>member4score</td> <td>membernscore</td> </tr> <tr> <td>testn</td> <td>Not taken</td> <td>member2score</td> <td>member3score</td> <td>member4score</td> <td>membernscore</td> </tr> </table> Thanks
  4. Thanks for replying. Atleast is there any formula for each normalization (1,2,3) to find out whether the table is normalized or not. I am to db and the theory about normalization is bit confusing me. There is not standard procedure i belive. Thanks
  5. Hello, I am new to mysql, Is there any tool to normalize database? Thanks
  6. 12 rows right. How to display the member names only once and the items the number of items they bought? I want to display like this, member_name1 item1 item2 item3 member_name2 item1 item2 item3 item4
  7. Hello, I have a table (members_table) and another table (purchased_table). Members contains fields (id, fname, lname, address). purchased_table has fields (purchased_id, member_id, purchased_item_id). To display i am using a join statement, SELECT * FROM members_table m INNER JOIN purchased_table p ON m.member_id=p.member_id WHERE m.member_id=10; The above query returns member_details as many items the member has brought items. I want to display the member details only once and purchased_items as many items as the member has brought. to display iam currently using, while($r = mysql_fetch_assoc($q)) { $fname = $r[fname]; $lname = $r[lname]; $r[purchased_item_id] = $r[purchased_item_id]; } Thanks
  8. Thank you. You almost got solved my problem. 1. member_id is not primary_key. memer_id will repeat as he attemps more than one test. In the first row, all the members should be displayed From the second row, all first column will have test names second row - from second column to member_n column members score is displayed. second row pattern repeats in third row, fourth row to test_n row Thanks
  9. Thanks. The problem is i have to show the test_name also. The structure is, member_id first_name last_name test_name score test_name In the first row, Members> member1 member2 member3 member n Members> is static text. member1, member2...member..n are dynamic In the second row, Tests V - - - - Tests V is static text. In the third row, test1 m1_t1_score m2_t1_score m3_t1_score mn_t1_score test1 is dynamic test name. m1_t1_score, m2_t1_score....mn_t1_score are scores of members in test1 in the fourth row, test2 m1_t2_score m2_t2_score m3_t2_score mn_t2_score test2 is dynamic test name. m1_t2_score, m2_t2_score ....mn_t2_score are scores of members in test2 This pattern continues till test n. Thanks
  10. Hello, I have a table in database where the member details are stored. member_id first_name last_name test_name score I want to retrive the above values and display in the below format. <table width="416" height="184" border="1"> <tr> <td width="62" height="23">Members > </td> <td width="80">member1</td> <td width="80">member2</td> <td width="80">member3</td> <td width="80">member...n</td> </tr> <tr> <td height="23"><p>Tests </p> <p>V</p></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td height="23">test1</td> <td>m1_t1_score</td> <td>m2_t1_score</td> <td>m3_t1_score</td> <td>m1_t1_score</td> </tr> <tr> <td height="23">test2</td> <td>m1_t2_score</td> <td>m2_t2_score</td> <td>m3_t2_score</td> <td>m2_t2_score</td> </tr> <tr> <td height="23">test...n</td> <td>m1_tn_score</td> <td>m2_tn_score</td> <td>m3_tn_score</td> <td>mn_tn_score</td> </tr> </table> Thanks
×
×
  • 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.