*You can check my Medium, I write blog about javascript and node.js.*

var My_function = function(my_name) {
  return new Promise(function(resolve, reject) {
    stmt = db.prepare ("SELECT number_table1 from my_table1 WHERE user=?");
      stmt.bind(my_name);
      stmt.get(function(error,row){
        if(error){
          throw err;
        }
        else{
          if(row){
            resolve(number_table1);
          }
          else{
            reject("error");
          }
         }
     });
  })
}

My_function.then(function(number_table1){
  console.log(number_table1)
},function(error){
  console.error(error)
})

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/53388c39-0c1e-4437-bd13-71b5dab1145e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to