问题描述
我正在创建一个工具,其中PHP作为前端,SQL Server作为后端。我有一些值插入到DB中,其中包含字符(''),即单引号。
当我试图将这些值插入数据库时,我遇到了错误。所以我使用replace()fn用两个单引号(''')替换单个引号('')。我也成功了。值已成功插入。
但是现在问题出现在尝试从数据库中检索值时。正常的选择查询没有成功。例如:
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:
推荐答案
这篇关于使用PHP在数据库中插入问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!