tidus97 Posted January 17, 2009 Share Posted January 17, 2009 hi guys. in my bit of code here: $query = "UPDATE users SET ".${'poll'.$pollId}." = '1' WHERE id='".$userArray[id]"'"; mysql_query($query) or die(mysql_error()); pollId is equal to 1 userArray[id] is also equal to one. what i would expect query to be is: UPDATE users SET poll1 = '1' WHERE id='1' ? Quote Link to comment https://forums.phpfreaks.com/topic/141169-solved-unexpected-t_constant_encapsed_string/ Share on other sites More sharing options...
RussellReal Posted January 17, 2009 Share Posted January 17, 2009 ".$userArray[id]"'"; missing concactinator ".$userArray[id]."'"; and also you should get into the habbit of adding quotes to everything that SHOULD be quoted ".$userArray['id']."'"; Quote Link to comment https://forums.phpfreaks.com/topic/141169-solved-unexpected-t_constant_encapsed_string/#findComment-738890 Share on other sites More sharing options...
tidus97 Posted January 17, 2009 Author Share Posted January 17, 2009 bah. i spent an hour and missed that error every time . thanks. and yes, i do put quotes. i dont have it there because i was just trialing different things, trying to find a solution. thx! Quote Link to comment https://forums.phpfreaks.com/topic/141169-solved-unexpected-t_constant_encapsed_string/#findComment-738894 Share on other sites More sharing options...
RussellReal Posted January 17, 2009 Share Posted January 17, 2009 anytime bro, please click "SOLVED" below Quote Link to comment https://forums.phpfreaks.com/topic/141169-solved-unexpected-t_constant_encapsed_string/#findComment-738899 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.