Trying to insert $_COOKIE into MySQL, result is always '0'
Posted: Mon Jul 12, 2010 12:06 am
I am trying to attach a referrer ID to each new account that is created. I have this ID saving to a cookie and, at the end of the following MySQL insert, I call the $_COOKIE superglobal to insert the contents into the 'refid' column:
However every time I run this script all it inserts is a 0 in the 'refid' column. I've tried everything! If I replace "$_COOKIE['refidC']" with any made up number like "514" it stores it into that column just fine, so I know that this code is working.
HELP?! I haven't been this stumped in a long time...
Code: Select all
if ( $result > 0) {
$query = "INSERT #__comprofiler ( `id` , `user_id` , `firstname` , `middlename` , `lastname` , `hits` , `message_last_sent` , `message_number_sent` , `avatar` , `avatarapproved` , `approved` , `confirmed` , `lastupdatedate` , `registeripaddr` , `cbactivation` , `banned` , `banneddate` , `unbanneddate` , `bannedby` , `unbannedby` , `bannedreason` , `acceptedterms` , `refid` ) VALUES(". $user->get('id') . ',' . $user->get('id') .", NULL , NULL , NULL , '0', '0000-00-00 00:00:00', '0', NULL , '1', '1', '1', '0000-00-00 00:00:00', '', '', '0', NULL , NULL , NULL , NULL , NULL , '0' , '" . $_COOKIE['refidC'] . "' )";HELP?! I haven't been this stumped in a long time...