title: Something wrong with mysqli_fetch_array in php?
body: <p>I am trying to create a booking system in php and mysql with a datepicker.
  When user selects a date a table with available period times should be displayed. If a time frame is available, the user should use the radio <code>input</code> and book that period of time.
  If I'm using 
      <code>"ORDER BY start ASC LIMIT 1"</code>.
  It gives me <code>8:22 exists</code>, and it's correct, but it not gives me the second statement, <code>8:30 exists</code>. Instead, for 8.30 it creates available time frame <code>8:30-8:38</code>.
  If I'm using 
      <code>"ORDER BY start ASC"</code>. 
  It multiplies the information based on how many records I have in database.
  I can't see what is wrong ! 
  Bellow are my code for mysql table:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `bookings` (
    `id` int(100) NOT NULL AUTO_INCREMENT,
    `date` date NOT NULL,
    `start` enum('8:22-8:30','8:30-8:38','8:38-8:46','8:46-8:54','8:54-9:02','9:02-9:10','9:18-9:26','9:26-9:34','9:34-9:42','9:42-9:50','9:50-10:58','10:58-11:06','11:06-11:14','11:14-11:22','11:22-11:30','11:30-11:38','11:38-11:46','11:46-11:54','11:54-12:02','12:30-12:38','12:38-12:46','12:46-12:54','12:54-13:02','13:02-13:10','13:10-13:18','13:18-13:26','13:26-13:34','13:34-13:42','13:42-13:50','13:50-13:58','13:58-14:06','14:06-14:14','14:14-14:22','14:22-14:30','14:30-14:38','14:38-14:46','14:46-14:54','14:54-15:02','15:02-15:10','15:10-15:18','15:18-15:26','15:26-15:34') COLLATE utf8_unicode_ci NOT NULL,
    `booked` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
    `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
    `email` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
    `phone` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `start` (`start`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;
  
  --
  -- Dumping data for table `bookings`
  --
  
  INSERT INTO `bookings` (`id`, `date`, `start`, `booked`, `name`, `email`, `phone`) VALUES
  (2, '2016-05-06', '8:30-8:38', '1', 'vcv', 'vxcv', 'xcvvc'),
  (1, '2016-05-06', '8:22-8:30', '1', 'zxccxz', 'xczcc', 'zxczxc'),
  (4, '2016-05-09', '9:02-9:10', '1', '', '', ''),
  (3, '2016-05-09', '8:38-8:46', '1', '', '', '');
  </code></pre>
  
  <p>And the code for <strong>index.php</strong> is:</p>
  
  <pre><code>    &lt;?php
  $conn = mysqli_connect("localhost", "", "", "");
  
  $post_at = "";
  $post_at_to_date = "";
  
  $queryCondition = "";
  if(!empty($_POST["search"]["post_at"])) {           
      $post_at = $_POST["search"]["post_at"];
      list($fid,$fim,$fiy) = explode("-",$post_at);
  
      $post_at_todate = date('Y-m-d');
      if(!empty($_POST["search"]["post_at"])) {
          $post_at_to_date = $_POST["search"]["post_at"];
          list($tid,$tim,$tiy) = explode("-",$_POST["search"]["post_at"]);
          $post_at_todate = "$tiy-$tim-$tid";
      }
  
      $queryCondition .= "WHERE date = '" . $post_at_todate . "' ";
  }
  
  $sql = "SELECT * from bookings " . $queryCondition . " ORDER BY start ASC LIMIT 1";
  $result = mysqli_query($conn,$sql);
  
  ?&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Recent Articles&lt;/title&gt;      
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"&gt;
  
  &lt;style&gt;
  .table-content{border-top:#CCCCCC 4px solid; width:50%;}
  .table-content th {padding:5px 20px; background: #F0F0F0;vertical-align:top;} 
  .table-content td {padding:5px 20px; border-bottom: #F0F0F0 1px solid;vertical-align:top;} 
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;&lt;input type="text" id="field_results" name="field_results" /&gt;  ...
  &lt;div class="demo-content"&gt;
      &lt;h2 class="title_with_link"&gt;Recent Articles&lt;/h2&gt;
    &lt;form name="frmSearch" method="post" action=""&gt;
   &lt;p class="search_input"&gt;
          &lt;input type="text" placeholder="From Date" id="post_at" name="search[post_at]" value="&lt;?php echo $post_at; ?&gt;" class="input-control" /&gt;          
      &lt;input type="submit" name="go" value="Search" &gt;
  &lt;/p&gt;
  &lt;?php if(!empty($result))    { ?&gt;
  &lt;table class="table-content"&gt;
        &lt;thead&gt;
      &lt;tr&gt;
  
        &lt;th width="30%"&gt;&lt;span&gt;Day&lt;/span&gt;&lt;/th&gt;
        &lt;th width="50%"&gt;&lt;span&gt;Time period&lt;/span&gt;&lt;/th&gt;           
        &lt;th width="20%"&gt;&lt;span&gt;Book&lt;/span&gt;&lt;/th&gt;      
      &lt;/tr&gt;
    &lt;/thead&gt;
  &lt;tbody&gt;
  &lt;?php
  
      //while ($row=mysqli_fetch_row($result))
      while($row = mysqli_fetch_array($result)) {
          if(preg_match('/8:22-8:30/',$row['start'])==TRUE){
              echo "8:22 exists";
          }else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;8:22-8:30&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '8:22-8:30' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/8:30-8:38/',$row['start'])==TRUE){
              echo "8:30 exists";
          }else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;8:30-8:38&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '8:30-8:38' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/8:38-8:46/',$row['start'])){
              echo "8:38 exists";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;8:38-8:46&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '8:38-8:46' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/8:46-8:54/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;8:46-8:54&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '8:46-8:54' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/8:54-9:02/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;8:54-9:02&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '8:54-9:02' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/9:02-9:10/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;9:02-9:10&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '9:02-9:10' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/9:18-9:26/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;9:18-9:26&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '9:18-9:26' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/9:26-9:34/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;9:26-9:34&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '9:26-9:34' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/9:34-9:42/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;9:34-9:42&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '9:34-9:42' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/9:42-9:50/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;9:42-9:50&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '9:42-9:50' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/9:50-10:58/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;9:50-10:58&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '9:50-10:58' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/10:58-11:06/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;10:58-11:06&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '10:58-11:06' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:06-11:14/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:06-11:14&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:06-11:14' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:14-11:22/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:14-11:22&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:14-11:22' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:22-11:30/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:22-11:30&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:22-11:30' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:30-11:38/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:30-11:38&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:30-11:38' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:38-11:46/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:38-11:46&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:38-11:46' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:46-11:54/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:46-11:54&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:46-11:54' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/11:54-12:02/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;11:54-12:02&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '11:54-12:02' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/12:30-12:38/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;12:30-12:38&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '12:30-12:38' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/12:38-12:46/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;12:38-12:46&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '12:38-12:46' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/12:46-12:54/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;12:46-12:54&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '12:46-12:54' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/12:54-13:02/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;12:54-13:02&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '12:54-13:02' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:02-13:10/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:02-13:10&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:02-13:10' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:10-13:18/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:10-13:18&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:10-13:18' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:18-13:26/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:18-13:26&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:18-13:26' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:26-13:34/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:26-13:34&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:26-13:34' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:34-13:42/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:34-13:42&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:34-13:42' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:42-13:50/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:42-13:50&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:42-13:50' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:50-13:58/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:50-13:58&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:50-13:58' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/13:58-14:06/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;13:58-14:06&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '13:58-14:06' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:06-14:14/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:06-14:14&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:06-14:14' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:14-14:22/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:14-14:22&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:14-14:22' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:22-14:30/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:22-14:30&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:22-14:30' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:30-14:38/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:30-14:38&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:30-14:38' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:38-14:46/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:38-14:46&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:38-14:46' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:46-14:54/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:46-14:54&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:46-14:54' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/14:54-15:02/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;14:54-15:02&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:54-15:02' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/15:02-15:10/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;15:02-15:10&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '14:54-15:02' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/15:10-15:18/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;15:10-15:18&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '15:10-15:18' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/15:18-15:26/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;15:18-15:26&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '15:18-15:26' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
          if(preg_match('/15:26-15:34/',$row['start'])){
              echo "";
          } else {
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;$post_at&lt;/td&gt;";
              echo "&lt;td&gt;15:26-15:34&lt;/td&gt;";
              echo '&lt;td&gt;&lt;input class="text" type="radio" id="rez" name="rez" value="'. '15:26-15:34' .'"&gt;&lt;/td&gt;';
              echo "&lt;/tr&gt;";
          }
   ?&gt;
      &lt;tr&gt;
  
  
      &lt;/tr&gt;
  &lt;?php
      }
  ?&gt;
  &lt;tbody&gt;
  &lt;/table&gt;
  &lt;?php } ?&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $.datepicker.setDefaults({
  showOn: "button",
  buttonImage: "datepicker.png",
  buttonText: "Date Picker",
  buttonImageOnly: true,
  dateFormat: 'dd-mm-yy'  
  });
  $(function() {
  $("#post_at").datepicker();
  $("#post_at_to_date").datepicker();
  });
  &lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function () {
  $(":radio").on('click', function () {
  
      var fields = '';
      $(":radio").each(function () {
          if (this.checked) {
              fields += $(this).val() + ' ';
          }
      });
      $('#field_results').val($.trim(fields))
  
  });
  });
  &lt;/script&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>