Link to home
Start Free TrialLog in
Avatar of lilyyan
lilyyan

asked on

is there a similar function: mysql_real_escape_string () for ms sql server

hello:

is there a similar function: mysql_real_escape_string () for ms sql server?

thank so much you for your reply!
Avatar of hielo
hielo
Flag of Wallis and Futuna image

No. You will need to write you own.
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilyyan
lilyyan

ASKER

thank you all so much!

q1: from this link: http://www.w3schools.com/php/func_string_addslashes.asp:
it says runs addslashes() on all GET, POST, and COOKIE data by default.  so i don't need excape the single quote

q2: in ths code snippet:
str_replace("'", "''", $data)
 
why it's not: str_replace("'", "\'", $data)?
 
thank you so much!

Open in new window

Avatar of lilyyan

ASKER

sorry, q2 should be
why it's not: str_replace("'", "\\'", $data)?
 
q1: from this link: http://www.w3schools.com/php/func_string_addslashes.asp:
it says php runs addslashes() on all GET, POST, and COOKIE data by default.  so i don't need excape the single quote?

thank you so much!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilyyan

ASKER

great, thanks so much!

how about excape double " ? in MS SQL-Server

it will be'"

right?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilyyan

ASKER

well, from this link  http://www.w3schools.com/php/func_string_addslashes.asp.

the double quotes need to be escaped... it's " not'' // please the code snippet

would you please exaplain a little bit : the special meaning of  single quote ' in sql.

i thought it is the same as a " (double quote )
it's " not''

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial