Jump to content

RogerTE

New Members
  • Posts

    2
  • Joined

  • Last visited

RogerTE's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I know I should, but want to continue format that was being used in the Delphi system which uses the same MySQL tables, and, the user wants to be able for both systems to co-exist, at least for the next year, +-----------+ +-----------------+ |StudentTbl | | StudentAwardTbl | |-----------| |-----------------| | person_id |------------| person_id | | forename | +--------| award_id | | surname | | | skills | | (etc,) | | | date_passed | +-----------+ | +-----------------+ | +-----------+ | +--------------+ | AwardsTbl | | |AwardSkillsTbl| |-----------| | |--------------| | award_id |---+---------| award_id | |award_name | | skill_desc | |passes_rqd | | display_ord | |award_body | +--------------+ +-----------+ There are other tables (e.g. a PersonSessionTbl which is also used but not shown here) Basically there are several awards, each award has several skills, some of which follow a natural order, and, for some awards the student only needs to complete, say, 8 out of the 10 (passes_rqd column) and it is this that is used to determine "date_passed" . Each HTML table will show all the students for a single session, and for a single award (AwardTbl) The AwardSkillsTbl is used to build the headings for the table rows, in the order determined by display_ord. The skills "array" follows the same display order. Hope this explains why not using completely normalised tables.
  2. Building a system for a local training charity, based on an old Delphi system, that was itself based on an old Clipper (DOS) system. (Basically teaching myself PHP as I am doing it) Within it there is a module for skill awards. There is a MySQL table with the structure : person_id (int) award_id int) skills (varchar in the format "0,1,0,0.1.0,0,1,0,0" where each 0 or 1 indicates whether skill has been acheived (1) or not (0). This is "exploded" into an array $skillarr) date_passed (date) This is null unless a certain number of skills has been acheived. Person_id and award_id together make up the primary key. The data is displayed in a HTML/Bootstrap table with each row consisting of: Name up to 10 checkboxes indicating whether passed (checked) or not Date passed (if passed) or empty cell Save button to allow updating of current row. (cannot use single save button for whole table) Currently each row is loaded using a similar routine I used for an attendance register: echo '<tr>'; echo '<td id="' . $memid . '">' . $name . '<input type="hidden" name="memberid[]" value="' . $memid . '" /></td>'; //Now the checkboxes for ($x = 0; $x < 10; $x++) { $visible = $checked = $bgcol = $dis = ''; $chkval = 0; if ($skillarr[$x] != "0") { // array setup from exploded datatbale skill column $checked = 'checked = "checked"'; // show it as checked $chkval = 1; $dis = 'disabled'; // but disable it as don't want changed } echo '<td align="center"><input type="hidden" name="chk[' . $memid . '][]" value = "' . $chkval . '"><input type="checkbox" onclick="this.previousSibling.value=1-this.previousSibling.value" class="style3" value = "' . $chkval . '" ' . $checked . '" "' . $visible . ' ></td>'; } echo '<td align="center" > $passdate</td>'; // Passed date goes here or null if not passed $var = $memid."/".$awardid; echo '<td><center><a href = "???????????????????????????" class = "btn btn-warning">Save</a></td>'; // <-----Not certain whether to use a PHP function on same page or pass to external PHP program echo '</tr>'; With the register system I mentioned earlier there is just a single save button that POSTed everyone 's data. However this will not work for this so have added save button at end of every row. However not sure best way to implement the save the data, as need to return to page after the save routine has updated table by imploding checkbox data, and updating/inserting the person/award record (including adding todays date if required number of skills has been passed. What would be the best way to handle this, and would welcome suggestions as to how to improve it. I have included a view as to what table looks like currently
×
×
  • 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.