0

please i need help. I'm not perfect on this so I followed a tutorial. and i get a "Parse error: syntax error, unexpected T_VARIABLE" on this line:

function updatephto($id,$tmpName,$ext){
if(move_uploaded_file($tmpName,"photos/userimages/".$id."."$ext) && mysqli_query("UPDATE `register` SET `photo`='".$ext."' WHERE `id`=".$id));

}

but in the tutorial, there was no error. Please help me out

1
  • Sure you are a developer? Commented Jan 20, 2016 at 9:06

1 Answer 1

1

You forgot to add (.) before $ext in move_uploaded_file

if(move_uploaded_file($tmpName,"photos/userimages/".$id."."$ext)

should:

if(move_uploaded_file($tmpName,"photos/userimages/".$id."." . $ext)
Sign up to request clarification or add additional context in comments.

5 Comments

thanks frozenFire. answered.
but i need more help. i get this error also: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING. and here is the line given;
echo "<img src='photos/userimages/'.$userdata['photo'].'.'.$userdata['photo'].' width='200' height='230'>"
When you start a (php) string literal with double-quotes it has to end with double-quotes, and if you start it with a single-quotes ...a single quote ends it. You have mixed that up twice.
thanks volkerK, it helped