If I enter (’ " ) into the cell and then reload the page, the backslashes will appear in the cell (’ " \).
How can I prevent that?
Please, is there anyone to help me? Please, try to type ’ " \ into cell (edtxt) and then reload the page. After I reload the page, my cell content changes to ’ " \.
Why the hell connector writes extra backslashes into database? Is this a bug or am I doing something wrong? Thanks in advance.
This is my code:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<script src="codebase/dhtmlxcommon.js"></script>
<script src="codebase/dhtmlxgrid.js"></script>
<script src="codebase/dhtmlxgridcell.js"></script>
<script src="codebase/dhtmlxdataprocessor.js"></script>
<script src="codebase/ext/dhtmlxgrid_validation.js"></script>
<script src="codebase/connector.js"></script>
<script>
var mygrid;
function doInitGrid() {
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("codebase/imgs/");
mygrid.setHeader("Name,Address,Phone");
mygrid.setInitWidths("150,150,*");
mygrid.setColAlign("left,left,left");
mygrid.setSkin("dhx_skyblue");
mygrid.setColSorting("str,str,str");
mygrid.setColTypes("edtxt,edtxt,edtxt");
mygrid.enableResizing("true,true,true");
mygrid.enableMultiselect(true);
mygrid.enableTooltips("false,false,false");
mygrid.enableValidation(true);
mygrid.setColValidators("NotEmpty");
mygrid.init();
mygrid.load("codebase/data.php");
myDataProcessor = new dataProcessor("codebase/data.php");
myDataProcessor.init(mygrid);
}
function addRow() {
var n = (new Date()).valueOf();
mygrid.addRow(n,["New name","",""],mygrid.getRowsNum());
setTimeout('mygrid.selectRow(mygrid.getRowsNum()-1)',500);
setTimeout('mygrid.selectCell(mygrid.getRowsNum()-1,0,true,false,true)',500);
}
function removeRow() {
mygrid.deleteSelectedRows();
}
</script>
</head>
<body onload="doInitGrid();">
<div id="mygrid_container" style="position:relative;width:600px;height:450px;"></div>
<button onclick="addRow()">Add</button> <button onclick="removeRow()">Remove</button><br>
</body>
</html>
data.php:
<?php
require_once("grid_connector.php");
$res=mysql_connect('localhost', 'user', 'password');
mysql_select_db("db");
$conn = new GridConnector($res,"MySQL");
$conn->render_table("Buyers","ID","Name,Address,Phone");
?>
Try to disable Magic Quotes in your php