0
如何在插入語句中插入單個qoute(')和反斜槓()?請求中插入單引號和反斜槓。getParameter
目前,我有這個
String message = request.getParameter("message");
insert = "INSERT INTO campaign (cid, uid, sender_id, content, dcs, Starttime, endtime, status, lastmodifiedid, creationtime, msisdnfile, number_subscribers) VALUES(" + cid + ", " + adminid + ", '"+ request.getParameter("sender_id") + "', '" + message + "', '" + dcs + "', '" +startDate + " " + request.getParameter("startTime") + "', '" + endTime + "', 'Pending', '" + adminid + "', NOW(), '" + uploadedfile + "', '" + number_of_subs + "')";
我需要,如果message.contains( ')或message.contains(' \ '),那麼它將會取代(\')或(\') 。我怎樣才能做到這一點?在此先感謝
我只需要更換的消息,並非所有 – 2013-04-23 08:59:31
啊對。然後在我的回答中將「插入」替換爲「消息」 – Savv 2013-04-23 09:01:37