title: Bootstrap alternating row color in dynamically created table
body: <p>Looking in Stack Overflow I found <a href="https://stackoverflow.com/questions/20825211/bootstrap-table-striped-how-do-i-change-the-stripe-background-colour">alternating row color</a>.
  While this seems to work on a static table, my results is that all rows are pink. I cannot get it to work on a PHP dynamically created table with bootstrap:</p>
  
  <pre><code>$mdbFile = "\myAccessDatabase.mdb";
  $pdo = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=$mdbFile", "", "");
  $query = $pdo-&gt;prepare("SELECT * FROM Table");  
  $query-&gt;execute();
  
  echo "&lt;table class='table table-striped table-bordered table-hover table-condensed table-responsive'&gt;";                 
  echo "&lt;thead&gt;&lt;tr&gt;";
  echo "&lt;th&gt;Last&lt;/th&gt;&lt;th&gt;First&lt;/th&gt;&lt;th&gt;XXX&lt;/th&gt;&lt;th&gt;YYY&lt;/th&gt;&lt;th&gt;ZZZ&lt;/th&gt;&lt;th&gt;WWW&lt;/th&gt;";
  echo "&lt;/tr&gt;&lt;/thead&gt;";
  
  for($i=0; $row = $query-&gt;fetch(); $i++){
      echo '&lt;tbody&gt;&lt;tr&gt;';
      //echo "&lt;th scope='row'&gt;1&lt;/th&gt;";
      echo "&lt;td&gt;".$row['LAST']."&lt;/td&gt;";
      echo "&lt;td&gt;".$row['FIRST']."&lt;/td&gt;";
      echo "&lt;td&gt;".$row['XXX']."&lt;/td&gt;";
      echo "&lt;td&gt;".$row['YYY']."&lt;/td&gt;";
      echo "&lt;td&gt;".$row['ZZZ']."&lt;/td&gt;";
      echo "&lt;td&gt;".$row['WWW']."&lt;/td&gt;";
  }
  echo "&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;"; 
  
  unset($pdo);
  unset($query);
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>.table-striped&gt;tbody&gt;tr:nth-child(odd)&gt;td,
      .table-striped&gt;tbody&gt;tr:nth-child(odd)&gt;th {
          background-color: pink;
      }
  </code></pre>