0

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.

Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
Dihia LANASRI
  • 133
  • 2
  • 6

0 Answers0