带引号的JSP MYSQL错误选择查询

时间:2015-04-02 21:58:15

标签: mysql jsp

我'试图创建一个没有成功的选择。

使用MYSQL,在where子句中,值使用简单的引号 - > '值&#39 ;.但是,我不知道如何以正确的方式做到这一点,以免出错。

 cn = ConnectionDB.getConection(); 

 Statement stmt = (Statement) cn.createStatement();

**String consulta = "SELECT * FROM books WHERE title like \"'"+value+"'\" OR author like \"'"+value+"'\" OR editorial like \"'"+value+"'\"";**


//Then i execute the query

**rst = stmt.executeQuery(consulta);**

0 个答案:

没有答案