Hi,
I am creating a tool with PHP as front end and SQL Server as back end. I have some values to be inserted into the DB which contains the character ( ' ) i.e single quote.
I had errors when i tried to insert such values into the DB. So I used the replace() fn to replace a single single quote ( ' ) by two single quotes ( '' ). I was successful in it also. Values got inserted successfully.
But the problem now arises while trying to retrieve the values from the DB. A normal select query didn't work out. For example:
Consider the value of name here to be abc'def.
Please help me out with this.
Thanks in advance.
I am creating a tool with PHP as front end and SQL Server as back end. I have some values to be inserted into the DB which contains the character ( ' ) i.e single quote.
I had errors when i tried to insert such values into the DB. So I used the replace() fn to replace a single single quote ( ' ) by two single quotes ( '' ). I was successful in it also. Values got inserted successfully.
But the problem now arises while trying to retrieve the values from the DB. A normal select query didn't work out. For example:
Code:
$query="select name from Table1"; $result=mssql_query($query); $row=mssql_fetch_row($result); $name=$row[0];
Please help me out with this.
Thanks in advance.
Comment