News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

update code

Started by cannedfool, July 18, 2005, 08:21:07 PM

Previous topic - Next topic

cannedfool

i have found that when te submit button is pressed on the forum it runs the method

modifyprofile2 in the profile.php file.

i was thinking i could then use it to update my database with the new added text files.

i wrote this code

//upload kayak, drink and quote information

$kayak = "$context['member']['options']['text_kayak']"
$quote = "$context['member']['options']['text_drink']"
$drink = "$context['member']['options']['text_quote']"

$connection=mysql_connect("127.0.0.1","***","*****") or die ("could not connect to server");
    $db = mysql_select_db("smf", $connection) or die ("could not connect to database");
$query = "UPDATE {$db_prefix}members SET kayak='$kayak', quote='$quote', drink='$drink'
WHERE ID_MEMBER != $memID
AND emailAddress = '$_POST[emailAddress]'
LIMIT 1", __FILE__, __LINE__)";
$result = mysql_query($query) or die ("couldn't execute query");


it brings up this error..


Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\Program Files\apachefriends\xampp\htdocs\UHCC\SMF\Sources\Profile.php on line 403

can anyone point me in the right direction of how this code should be written?

thanks


۞

You're missiong some semicolons:

This:
$kayak = "$context['member']['options']['text_kayak']"
$quote = "$context['member']['options']['text_drink']"
$drink = "$context['member']['options']['text_quote']"


Sbould be:
(And you don't need the quotes around the variables either.)


$kayak = $context['member']['options']['text_kayak'];
$quote = $context['member']['options']['text_drink'];
$drink = $context['member']['options']['text_quote'];


If that doesn't fix it, the line numbers would help. What line is  the comment on?
TTTTTT  OOOOOO MMMMMM   BBBBBB


Advertisement: