Trouble passing PHP variable data to MySQL database?

Viper

New member
Okay I have this code:

//db connect code is here, no need to past it here

$MY_DATA = $_REQUEST["MY_DATA"];

mysql_query("Update users
SET user_db_data = '$MYDATA'
WHERE user_email = '$_SESSION[user]'
") or die(mysql_error());

Now I know the database connection and update function works, because if I replace SET user_db_data = '$MYDATA' with SET user_db_data = '123' then 123 gets entered into the database.

And I know that $MYDATA does contain a value, I have confirmed that.

So I have narrowed the problem down to this line
SET user_db_data = '$MYDATA'

Can you see what is wrong? I do not get an error message and just a blank entry goes in the database. Am I not writing this correctly for the variable? Just having an off day. Anyone got any ideas?
Oh and don't say I missed the _ on MY_DATA to MYDATA - that was a typo here. It's all the same (but a different) variable name.
 
Back
Top