node and mysql like 1

node and mysql like

   return db.query(`SELECT * FROM user WHERE fullname LIKE N'%${data.fullname}%' ORDER BY create_time DESC LIMIT ?, ? `, [data.start,data.limit], callback);

Here is what the above code is Doing:
1. We are using the query method of the db object to execute a SQL query.
2. The first parameter of the query method is the SQL query.
3. The second parameter is an array of values that will be passed to the query.
4. The third parameter is a callback function that will be called when the query is executed.
5. The callback function will have two parameters, err and result.
6. The err parameter will contain any error that occurred during the execution of the query.
7. The result parameter will contain the result of the query.
8. The result parameter will be an array of objects.
9. Each object in the array will represent a row in the table.
10. The properties of the object will be the columns of the table.

Similar Posts