javascript - Deleting table rows from Mysql using Node js -


im having trouble deleting table row mysql database. when click on button "delete" on website, has remove content row. code:

index.ejs:

    <% if(pictures.length){ %>                  <table style="width:100%">                 <tr>                     <th>image</th>                     <th>driver</th>                     <th>team</th>                     <th>location</th>                                            <% if(admin) { %>                     <th>edit</th>                     <th>delete</th>                     <% } %>                 </tr>     <% } %>         <% (var = 0; < pictures.length; i++) { %>             <tr>                 <td><img src="images/<%= pictures[i].image %>" /></td>                 <td><%= pictures[i].driver %></td>                 <td><%= pictures[i].team %></td>                 <td><%= pictures[i].location %></td>                                     <% if(admin) { %>                 <td><a href="edit/<%= pictures[i].id %>" >edit</a></td>                 <td><a href="/<%= pictures[i].id %>">delete</a></td>                 <% } %>      <% } %>             </tr>                                </table>      </div> 

edit.js:

router.get('/:id', function(req, res) {   var id = req.params.id;   req.getconnection(function (err, connection) {     connection.query("delete pictures id = ? ", [id], function(err, results) {          res.redirect('/');          console.log('some data has been deleted')     });   }); }); 

this error i'm getting:

cannot /10 (10 id table)

thanks in advance!


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -