[php] фффф
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- var mysql = require('mysql');
- function el(selector) {
- return document.getElementById(selector);
- }
- el('action-btn').addEventListener('click', function(){
- // Get the mysql service
- getFirstTenRows(function(rows){
- var html = '';
- rows.forEach(function(row){
- html += '';
- html += '';
- html += row.id;
- html += '';
- html += '';
- html += row.name;
- html += '';
- html += '';
- console.log(row);
- });
- document.querySelector('#table > tbody').innerHTML = html;
- });
- },false);
- function getFirstTenRows(callback){
- var mysql = require('mysql');
- // Add the credentials to access your database
- var connection = mysql.createConnection({
- host : 'localhost',
- user : 'bankir',
- password : 'bankir2721',
- database : 'main'
- });
- // connect to mysql
- connection.connect(function(err) {
- // in case of error
- if(err){
- console.log(err.code);
- console.log(err.fatal);
- }
- });
- // Perform a query
- var now = '2021-09-24';
- $query = "SELECT * FROM `payment` WHERE `data`= 'now'";
- connection.query($query, function(err, rows, fields) {
- if(err){
- console.log("An error ocurred performing the query.");
- console.log(err);
- return;
- }
- callback(rows);
- console.log("Query succesfully executed");
- });
- // Close the connection
- connection.end(function(){
- // The connection has been closed
- });
- }
Editor
You can edit this paste and save as new: