[php] фффф

Viewer

copydownloadembedprintName: фффф
  1. var mysql = require('mysql');
  2.   function el(selector) {
  3.   return document.getElementById(selector);
  4.   }
  5.   el('action-btn').addEventListener('click', function(){
  6.   // Get the mysql service
  7.   getFirstTenRows(function(rows){
  8.   var html = '';
  9.   rows.forEach(function(row){
  10.   html += '';
  11.   html += '';
  12.   html += row.id;
  13.   html += '';
  14.   html += '';
  15.   html += row.name;
  16.   html += '';
  17.   html += '';
  18.   console.log(row);
  19.   });
  20.   document.querySelector('#table > tbody').innerHTML = html;
  21.   });
  22.   },false);
  23.   function getFirstTenRows(callback){
  24.   var mysql = require('mysql');
  25.   // Add the credentials to access your database
  26.   var connection = mysql.createConnection({
  27.   host     : 'localhost',
  28.   user     : 'bankir',
  29.   password : 'bankir2721',
  30.   database : 'main'
  31.   });
  32.   // connect to mysql
  33.   connection.connect(function(err) {
  34.   // in case of error
  35.   if(err){
  36.   console.log(err.code);
  37.   console.log(err.fatal);
  38.   }
  39.   });
  40.   // Perform a query
  41.   var now = '2021-09-24';
  42.  
  43.   $query = "SELECT * FROM `payment`   WHERE `data`= 'now'";
  44.   connection.query($query, function(err, rows, fields) {
  45.   if(err){
  46.   console.log("An error ocurred performing the query.");
  47.   console.log(err);
  48.   return;
  49.   }
  50.   callback(rows);
  51.   console.log("Query succesfully executed");
  52.   });
  53.   // Close the connection
  54.   connection.end(function(){
  55.   // The connection has been closed
  56.   });
  57.   }

Editor

You can edit this paste and save as new:


File Description
  • фффф
  • Paste Code
  • 24 Sep-2021
  • 1.37 Kb
You can Share it: