php - Find the students whose time interval clashes with themselves? -


in simple words. have query displays table. (students usn group concatenated, , displayed whole row foreach).

row 1 => subject 1 - 22/07/2015 - 08:00 - 1xx10xx086, 1xx10xx087, 1xx09xx088

row 2 => subject 2 - 22/07/2015 - 09:00 - 1xx10xx086, 1xx10xx087, 1xx09xx088

row 3 => subject 3 - 22/07/2015 - 08:00 - 1xx10xx096, 1xx10xx086, 1xx09xx098

row 4 => subject 4 - 22/07/2015 - 10:00 - 1xx10xx096, 1xx10xx086, 1xx09xx098

row 5 => subject 5 - 22/07/2015 - 08:00 - 1xx10xx106, 1xx10xx107, 1xx09xx108

how shall highlight in jquery or html or php or 1xx10xx086 roll no cant attend both subject 1, subject 3 @ same day , same time can attend subject 2 @ different time slot. how shall hight light them.?

assuming table , want highlight required td jquery, can next example:

the idea loop table rows , compare td date info if 2 rows have td same date split , compare td groups info, if first array(all values in group td exploded ,) contains 1 or more values second array highlight both.

$(document).ready(function(){      $('tr').each(function( index ) {          var current=$(this);          current.nextall('tr').each(function( index ) {              if(current.children( ".date" ).html()==$(this).children( ".date" ).html()){                  var child=$(this);                  var = current.children( ".groups" ).html().split(',');                  var b = child.children( ".groups" ).html().split(',');                     $.each( a, function( key, value ) {                         if($.inarray( value,  b ) != -1){                                                      ///edit                           current.children( ".groups" ).html(current.children( ".groups" ).html().replace(                                new regexp(value, 'g'), '<span class=markme >'+value+'</span>'                            ));                           child.children( ".groups" ).html(child.children( ".groups" ).html().replace(                                new regexp(value, 'g'), '<span class=markme >'+value+'</span>'                            ));                                                       /////////                         }                                            });                                }          });      });  });
.markme {      color: red;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <table  border="1">      <tr>          <td class="subject">subject 1</td>          <td class="date">22/07/2015 - 08:00</td>          <td class="groups">1xx10xx086,1xx10xx087,1xx09xx088</td>      </tr>      <tr>          <td class="subject">subject </td>          <td class="date">22/07/2015 - 09:00</td>          <td class="groups">1xx10xx086,1xx10xx087,1xx09xx088</td>      </tr>      <tr>          <td class="subject">subject 3</td>          <td class="date">22/07/2015 - 08:00</td>          <td class="groups">1xx10xx096,1xx10xx086,1xx09xx098</td>      </tr>      <tr>          <td class="subject">subject 4</td>          <td class="date">22/07/2015 - 10:00</td>          <td class="groups">1xx10xx096,1xx10xx086,1xx09xx098</td>      </tr>      <tr>          <td class="subject">subject 5</td>          <td class="date">22/07/2015 - 08:00</td>          <td class="groups">1xx10xx106,1xx10xx107,1xx09xx108</td>      </tr>        </table>


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -