Good day good pple of the forum,
Please i have some data coming from a database and i need to display them using javascript. The problem some of the records have single quotes and some have double quotes. How do i escape this at once.
Code:
The above code works when the recordset has single quotes. but when the recordset has both single and double quotes the code goes blank.PHP Code:<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<%
Dim conn,rs,sql_select,data_source
set conn=server.CreateObject("ADODB.CONNECTION")
set rs=server.CreateObject("adodb.recordset")
data_source="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("db\test.mdb")
conn.open data_source
sql_select="SELECT * FROM coursequestion_getconnected"
rs.open sql_select,conn,3,1
%>
<script type="text/javascript">
document.write("<%
while (not rs.eof)
response.write rs("coursequest")&"<br>"
rs.movenext
wend%>")
</script>
</body>
</html>
How do i get around this?




Bookmarks