Hello,
I'm trying to use NodeJS with PHP.
I want to use NodeJS to instantly insert information into a MYSQL database without refreshing the page. (With PHP you have to refresh).
Only thing is. I installed NodeJS and RequireJS. But it cant find the mysql.js file which is included with NodeJS. Do you have to set up the path towards it. Or instal it in the same directory in PHP. I dont know whats going on.
I also added a screenshot with the error code i recieve from the console.

The code im using to insert the information towards the database with Javascript.
document.getElementById('addDatabase').onclick = function() {
var dateNow = "<?php echo $date; ?>";
var orderlog = "<?php echo $idorderlogFinal; ?>";
var idorder = "<?php echo $row->idorder; ?>";
var username = "<?php echo $_SESSION["username"]; ?>";
var inputVal = document.getElementById("textDatabase").value;
var mysql = require(['mysql']);
<?php
include('includes/conJava.php')
?>
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "INSERT INTO picqer_salesorder_notes (idorder_log, idorder, `user`, description, created_at) VALUES (orderlog, idorder, username, inputVal, dateNow)";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
});
}
</script>```
