I have been trying to use like query on MySQL but it won't match the pattern with database and only works when the exact keyword is given(% sign doesn't work)
I have tried Concat method, using backslash for special characters,+ symbol and every other approach I can find but still, it isn't working
connection.query('SELECT * FROM job where domainname like ?', '%' + request.body.domain + '%' ,function(error, results){
response.render('./results',{rows:results});
});
and on front end part
<tbody>
<% for(var i=0; i < rows.length; i++) { %>
<tr>
<td><%= i %></td>
<td><%= rows[i].companyname %></td>
<td><%= rows[i].domainname %></td>
</tr>
<% } %>
Error: Cannot read property 'length' of undefined it works if I don't use % and don't try pattern matching and then shows the results.