Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

mysql2 installation

npm install --save mysql2
Comment

mysql2 installation

// get the client
const mysql = require('mysql2');

// create the connection to database
const connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  database: 'test'
});

// simple query
connection.query(
  'SELECT * FROM `table` WHERE `name` = "Page" AND `age` > 45',
  function(err, results, fields) {
    console.log(results); // results contains rows returned by server
    console.log(fields); // fields contains extra meta data about results, if available
  }
);

// with placeholder
connection.query(
  'SELECT * FROM `table` WHERE `name` = ? AND `age` > ?',
  ['Page', 45],
  function(err, results) {
    console.log(results);
  }
);
Comment

PREVIOUS NEXT
Code Example
Shell :: git remove upstream branch 
Shell :: how to know the wifi password on windows 10 
Shell :: angular cli global update 
Shell :: tailwind plugin prettier 
Shell :: how to check for angular cli version 
Shell :: brew Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/webhasan/Library/LaunchAgents/homebrew.mxcl.httpd.plist` exited with 5. 
Shell :: restart nginx ubuntu 
Shell :: check postgres process in mac 
Shell :: unable to resolve reference git 
Shell :: pip install hashlib 
Shell :: xrandr add 1366 
Shell :: remote: HTTP Basic: Access denied fatal: Authentication failed for 
Shell :: check redhat version 
Shell :: du -sh sort size 
Shell :: undo commit git before push 
Shell :: gpg: WARNING: unsafe permissions on homedir 
Shell :: how to upgrade docker-compose to latest version 
Shell :: No matching distribution found for PyJWT==2.0.1 
Shell :: spacy install en_core_web_lg 
Shell :: how to add flutter packages from git 
Shell :: install openjdk ubuntu 
Shell :: bash install apache 
Shell :: install powershell 
Shell :: bash print array 
Shell :: gitignore .idea 
Shell :: yarn install in ubuntu 
Shell :: set defualt branch to main git 
Shell :: extract numners from string linux 
Shell :: sudo apt-get -y install postgresql 
Shell :: restart server centos 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =