I just found out how to retrieve data from a database with this javascript (index.js) code on the server side;
con.connect(function(err) {
con.query("SELECT Cliente FROM Tab_Clienti;", function (err, result, fields) {
if (err) throw err;
console.log(result);
});
});
and this is part of the result:
RowDataPacket { Cliente: 'GALLERIA DELL ACCADEMIA DI FIRENZE AUDIO - VIDEO'},
RowDataPacket { Cliente: 'ZETEMA AUDIO - VIDEO' },
RowDataPacket { Cliente: 'TERRE DES HOMMES AUDIO - VIDEO' },
RowDataPacket { Cliente: 'ISMETT AUDIO - VIDEO' },
RowDataPacket { Cliente: 'PRAGMATIKA AUDIO - VIDEO' },
RowDataPacket { Cliente: 'CANTINA DI SOAVE AUDIO - VIDEO' },
how can I get this information and put it into my working .html file, each information should be inserted into the tag, as shown below:
<select multiple class="form-control" id="clienti">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
my client file is called app.js for information only.
source
share