Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
Database set up with js and ejs pages to allow for crud but select all statement isnt working

I'm attempting to get my database to display all the data from the books table. When I activate node and open the server I don't get any errors but the table info isn't displayed either.

Any help would be amazing thanks

this is the code for the data to be displayed

<table>
 <% for(var i=0; i < books_e.length; i++) { %>
  <tr>
   <td><%= books_e[i].book_name %></td>
  </tr>
  <% } %>
</table>  

this is the route code

router.get('/', function(req, res, next) {
  var connection = new MySql({
    host: connection_details.host,
    user: connection_details.user,
    password: connection_details.password,
    database: connection_details.database
  });
  var books_e = connection.query("SELECT * FROM books;");
  
  res.render('books', { title: 'books', books_e:books_e });
});
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!