Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The question I have is in the images, which provides code for the process Im working on. Using Node Is, I would like to be

The question I have is in the images, which provides code for the process Im working on.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Using Node Is, I would like to be able to update fields in MySQL Database. To load data into a table with editable fields, I would call upon a function to queue the data in a file called get_faq.js: var mysql = require('mysql2'); var sql = require('../../settings.js'): const connection = mysql.createConnection(sql): exports.getAll-function(data) { connection.query SELECT * FROM faq_sections, function(err, headers, fields) ifferr) datal error: err}); }else{ connection.query 'SELECT * FROM faq WHERE sectionId=1'. function(err, general, fields) { if(er){ data(error: err}); else connection.query "SELECT * FROM faq WHERE section Id=2', function(err, forfamilies, fields) if(err) { data(error: err}); else connection.query 'SELECT * FROM faq WHERE sectionId=3'. function(err, allhouses, fields) { if(err) data errorerr}); else connection.query "SELECT * FROM faq WHERE section ld , function(err, transportation, fields) if(err) { data[error: err}); else connection.query 'SELECT * FROM faq WHERE sectionId=5'. function(err, neville, fields) { ifier) data( error: err}); else { /datal 'headers': headers, general': general, 'families': families, 'allhouses': allhouses, transportation': transportation, 'neville': neville) connection.query "SELECT * FROM faq WHERE section id=6. function(err, shadyside, fields) { if(er) data(error: ent}); else: connection.query "SELECT FROM faq WHERE section Id-7. function(err, universityplace, fields) if(err) data[error: err}); else { data[{"headers': headers, genera general, 'families': forfamilies, 'allhouses': allhouses, transportation': transportation, 'neville neville, 'shadyside': shadyside, 'universityplace': universityplace)); This loads the data into a page called faq.handlebars. This is achieved using this code in the index.js file: app.get('/faq', function(req,res) { GET_Faq.getAlk(function(data) { if(data.error) res.redirect(500); else { res.render('faq'. headers data.headers, general data general, allhouses : data.allhouses, forfamilies : data. families, transportation data transportation, neville : data.neville, shadyside data.shadyside, universityplace: data universityplace and is displayed like this in faq.handlebars:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions