mySQL如果X> Y不保存信息

时间:2012-07-06 15:58:34

标签: jquery

我有一个存储API返回信息的函数。

我已经有一个if语句告诉用户返回的调用的准确性太低了。但是我如何为我的mysql语句做同样的事情呢?

if(tag.uid == 0) s += "I got something, but the data wasn't clear. Sorry.";
     if(tag.confidence < 80) {
      s += "<li>User identification accuracy was too low, please try again</li>";
    }
     else if(tag.uid) { s += "<li> User:" + uid + "</li>";
     if(tag.uid) s += "<li> Accuracy:" + tag.confidence + "%" + "</li>";
     if(tag.uid) s += "<li> Timestamp:" + log_time + "</li>";
    }


    } 
    if(photo.tags.length) {
      if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
      }
      xmlhttp.open("GET", "mysql/save.php?uid=" + tag.uid + "&month=" + month + "&day=" + day + "&hours=" + hours + "&min=" + min + "&suffix=" + suffix + "&accuracy=" + tag.confidence,  true);
      xmlhttp.send();
    } 

我认为它与前面的语句几乎相同但不知道如何编写错误语句,因为我不想提醒用户错误,只是在准确率提高之前不保存任何信息。

1 个答案:

答案 0 :(得分:0)

没关系,实际上非常简单。

if(photo.tags.length) {
      var tag = photo.tags[0].uids[0];
      s += "<p>";
     //$('#result') .html ('Welcome Back:' + photo.uid + ',' + 'Confidence:' + photo.confidence);
     if(tag.uid == 0) s += "I got something, but the data wasn't clear. Sorry.";
     if(tag.confidence < 80) 
      {
      s += "<li>User identification accuracy was too low, please try again</li>";
      }
     else if(tag.uid) { 
       s += "<li> User:" + uid + "</li>";
       if(tag.uid) s += "<li> Accuracy:" + tag.confidence + "%" + "</li>";
       if(tag.uid) s += "<li> Timestamp:" + log_time + "</li>";
       if (window.XMLHttpRequest) 
        {
          xmlhttp = new XMLHttpRequest();
        }
        xmlhttp.open("GET", "mysql/save.php?uid=" + tag.uid + "&month=" + month + "&day=" + day + "&hours=" + hours + "&min=" + min + "&suffix=" + suffix + "&accuracy=" + tag.confidence,  true);
        xmlhttp.send();
      }
    }