0

Hello,
I am trying to use the mysql_real_escape_string() function, but I can't seem to use it without losing the content of the variable. When I use

$act="It's now or never"
$act=mysql_real_escape_string($act);{

then attempt to insert the value of $act--it comes out null.

I have established the database connection, so that does not appear to be the problem.

Any idea what I'm doing wrong.

5
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by liamfriel
0

hmmm what is the { at the end of the $act=mysql_real_escape_string($act);

Indeed and did you use mysql_connect() before the mysql_real_escape_string() function? You need a mysql connection open before you are able to use mysql_real_escape_string().

0

cwarn23--Yes, I've established the database connection with mysql_connect()--I call it just before the mysql_real_escape_string() function.

ApocDen--I checked to see if the form field feeding the variable was empty before assigning the value--the "{" is from the the If-Else statement.

Thanks for any help you can provide--I've tried to use this function many times, but always have the same experience. It appears to be a very useful function and easier that using REPLACE.

0

Hi visualmonk,

It may have been a typo, but don't you need a semicolon at the end of line1?

$act="It's now or never"[B];[/B]

Zagga

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.