title: Javascript won't work with php variabiles
body: <p>I have a big problem with my php &amp; javascript code.</p>
  
  <pre><code>while($row = mysqli_fetch_array($doquery, MYSQLI_ASSOC)) {
  
  
  
              echo ("
  
              &lt;!-- Inizio Item--&gt;
                  &lt;script type='text/javascript'&gt;
  
                  var end = new Date('".$row['fine']."');
  
  
                  var _second = 1000;
                  var _minute = _second * 60;
                  var _hour = _minute * 60;
                  var _day = _hour * 24;
                  var timer;
  
                  function showRemaining() {
                      var now = new Date();
                      var distance = end - now;
                      if (distance &lt; 0) {
  
                          clearInterval(timer);
                          document.getElementById('countdown".$row['id']."').innerHTML = 'EXPIRED!';
  
                          return;
                      }
                  var days = Math.floor(distance / _day);
                  var hours = Math.floor((distance % _day) / _hour);
                  var minutes = Math.floor((distance % _hour) / _minute);
                  var seconds = Math.floor((distance % _minute) / _second);
  
                  document.getElementById('countdown".$row['id']."').innerHTML = days + ' Days ';
                  document.getElementById('countdown".$row['id']."').innerHTML += hours + ' Hours ';
                  document.getElementById('countdown".$row['id']."').innerHTML += minutes + ' Mins ';
                  document.getElementById('countdown".$row['id']."').innerHTML += seconds + ' Secs';
                  } 
                  &lt;/script&gt;
                  &lt;div id='countdown".$row['id']."'&gt;&lt;/div&gt;
             ");
  }
  </code></pre>
  
  <p>If i use this code, i get this in the countdown: </p>
  
  <pre><code>NaN days NaN Hours Nan Mins NaN Secs
  </code></pre>
  
  <p>i've checked the output of </p>
  
  <pre><code>$row['fine'];
  </code></pre>
  
  <p>and the output it is in the right form asked from javascript. Infact, the output is  <code>08/01/2017 3:45 PM</code></p>
  
  <p>Infact, if i try to put the date directly in the code, like this:</p>
  
  <pre><code>... 
  var end = new Date('08/01/2016 3:45 PM ');
  ...
  </code></pre>
  
  <p>it shows the timer as it is supposed to do.</p>