title: lvl system not working with mysql - Discord Bot
body: <p>So Im trying to make leveling system in my bot but the problem is that when it reaches enough xp to lvl up it will remove the xp but wont add level. I dont know what is wrong with my code but its not working Im using the same technique for editing xp so it adds them but its not working for lvl so Imagine it like this. <code>User message ---&gt; generates enough xp for lvl up ---&gt; lvls up</code>. But instead of that it remains on level 1 I think I was searching everywhere for answer but found none. My code is here:</p>
  
  <pre><code>  let prf = ".";
    let messageArray = message.content.split(" ");
    if(message.author.bot) return;
  
    con.query(`SELECT * FROM xplvl WHERE id = '${message.author.id}'`, (err, rows) =&gt; {
      if (err) throw err;
      let sql;
      if (rows.length &lt; 1){
        sql = `INSERT INTO xplvl (id, xp, lvl) VALUES ('${message.author.id}', ${Generatexp()}, ${lvlup()})`
      }else{
        let xp = rows[0].xp;
        let lvl = rows[0].lvl;
        let tnlx = 100 * lvl;
        let l = 1;
        sql = `UPDATE xplvl SET xp = ${xp + Generatexp()} WHERE id = '${message.author.id}'`;
        if(xp &gt;= tnlx) {
          sql = `UPDATE xplvl SET lvl = ${lvl + l} WHERE id = '${message.author.id}'`;
          sql = `UPDATE xplvl SET xp = 0`;
          message.channel.send("You leveled up!")
          con.query(sql);
          return;
        }
      }
      con.query(sql)
    })
  </code></pre>