0

Can someone explain to me what i do wrong? In Below code the varibale "getunique: d" is not working for grepping something from my mysql database.

If i change variable "getunique: d" in "getunique: '27-04'" all work good.

not working version:

for (var i = 0; i < 1; i++) {
  var d = date.getDate() + "-" + (date.getMonth()+1);
  dates.push(d);
  date.setDate(date.getDate() - 1);

  $.get("../../includes/api.php", {
    getunique: d //-->> This line is not working "getunique: '27-04'" will work
  }).done(function(data) {
    var sdata = jQuery.parseJSON(data);
    counts.push(sdata.length);
    alert(d + '---' + data);
  });
}

Output: 29-4---false

Working version:

for (var i = 0; i < 30; i++) {
  var d = date.getDate() + "-" + (date.getMonth()+1);
  dates.push(d);
  date.setDate(date.getDate() - 1);

  $.get("../../includes/api.php", {
    getunique: "27-04" //-->> This line is not working "getunique: '27-04'" will work
  }).done(function(data) {
    var sdata = jQuery.parseJSON(data);
    counts.push(sdata.length);
  });
}

Output: 29-4---[{"ip":"192.168.178.143","0":"192.168.178.143"}, {"ip":"192.168.178.185","0":"192.168.178.185"}]

0 Answers0