Jump to content

Search the Community

Showing results for tags 'await'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. Hey guys, I need your help with a problem I’ve been able to walk around so far. Namely, I want to make a mysql query in a node.js web socket: connection.query("SELECT * FROM DB WHERE id= ?;", [id], function(error, results, fields) { if (error) throw error; // Code here... }) In the variable results I can now use the data in the form of a JSON object. That’s not a problem. So far, I have done this so that when I wanted to make several queries, I have nested into each other. Like this: connection.query("SELECT * FROM DB WHERE id= ?;", [id], function(error, results, fields) { if (error) throw error; connection.query("SELECT * FROM DB WHERE id= ?;", [id], function(error, results, fields) { if (error) throw error; // Code here... }) }) But now I need that some queries are only carried out if certain conditions are met. As a result, the queries can no longer be logically nested. That’s why I need something like this: if(a == b) { connection.query("SELECT * FROM DB WHERE id= ?;", [id], function(error, results1, fields) { if (error) throw error; // Code here... }) } if(c == b) { connection.query("SELECT * FROM DB WHERE id= ?;", [id], function(error, results2, fields) { if (error) throw error; // Code here... }) } And after both if loops I can logically no longer access the values results1 and results2. How can I do that? Do you need more information. I hope for some answers. Yours, Ben
×
×
  • Create New...