Yangi formatda davom etish uchun: https://uzfor.net/view.php?act=post&id=84548
Postga havola
Akbarali [2384] [off]
Биринчи код бунда mysql da sql bazadan ma'lumot olib ekranga uzatadi.
41 soniyadan keyin yozdi:
Vaqti vaqti bilan yozib boraman
app.js (+/-)
var mysql = require('mysql'); var http = require('http'); var connection = mysql.createConnection({ host: "localhost", user: "login", password: "login", database: "login" }); http.createServer(function(req, res, rows) { res.writeHead(200, { 'Content-Type': 'text/html' }); res.write( '<!DOCTYPE html>' +'<head>' +'<meta charset="utf-8">' +'<title>Maqolalar</title>' +'</head>' +'<body>' +'<table align="center" border="1px">' +'<h1 align="center">Bloglar</h1>'); var queryString = 'SELECT id, name FROM ustun_nomi'; var stroka = ""; connection.query(queryString, function(err, rows, fields) { if (err) throw err; for (var i in rows) { stroka = '<tr><td>'+rows[i].id+'</td><td>'+rows[i].name+'</td></tr>'; res.write(stroka); } res.write('</table>' +'</body>' +'</html>'); res.end(); }); }).listen(3000);
41 soniyadan keyin yozdi:
Vaqti vaqti bilan yozib boraman