I'm new in web developing. I want to query an SQLite database from HTML script balise. for more details, I share my code.
function test() {
var fullname;
var fname = "bishoy";
const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database('./Basket.db');
let sql = 'SELECT * FROM [Source: players]';
db.each(sql, [fname], (err, row) => {
if (err) {
throw err;
}
fullname = ('${row.Name}');
alert(fullname);;
});
db.close();
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button type="button" onclick="test()" style="font-family:cambria;
">Execute</button>
</body>
</html>
the problem that I encounter when I execute it on my Chrome browser: storage.html:8 Uncaught ReferenceError: require is not defined at test (storage.html:8) at HTMLButtonElement.onclick (storage.html:22) , please someone can help me to fix the problem.