sfraise Posted April 3, 2010 Share Posted April 3, 2010 I'm guessing the '%USERS%' part of the code is where the issue is but no matter what I try I can't seem to get this code to work. The funny thing is this worked fine on my previous server but since I moved to a new one it doesn't. If I try to change it to any variation of "%USERS%"' then I get an sql error. I'm sure this is something simple but I just can't get it. <?php /** * @version 1.0 $ * @package cbprofilecall * @copyright (C) 2008 OohYa Chat * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL **/ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); $dummyURl = sefRelToabs( 'http://www.oohya.net/index.php?option=com_comprofiler&task=userProfile& amp;user='%USER%') ?> Quote Link to comment https://forums.phpfreaks.com/topic/197478-t_encapsed_and_whitespace-error/ Share on other sites More sharing options...
GetPutDelete Posted April 3, 2010 Share Posted April 3, 2010 I've escaped the quotes for you, this will make sure it remains part of the string. (Notice the colour change). Also I've added a ; to the end of the function to end it. <?php /** * @version 1.0 $ * @package cbprofilecall * @copyright (C) 2008 OohYa Chat * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL **/ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); $dummyURl = sefRelToabs( 'http://www.oohya.net/index.php?option=com_comprofiler&task=userProfile& amp;user=\'%USER%\''); ?> Quote Link to comment https://forums.phpfreaks.com/topic/197478-t_encapsed_and_whitespace-error/#findComment-1036492 Share on other sites More sharing options...
premiso Posted April 3, 2010 Share Posted April 3, 2010 One, your quotes (single) needed to be escaped or it put inside of Double Quotes. $dummyURl = sefRelToabs("http://www.oohya.net/index.php?option=com_comprofiler&task=userProfile&user='%USER%'"); Also you had the & amp on separate lines, need to be on the same line. Try the above on one line and see how it goes. Quote Link to comment https://forums.phpfreaks.com/topic/197478-t_encapsed_and_whitespace-error/#findComment-1036493 Share on other sites More sharing options...
sfraise Posted April 3, 2010 Author Share Posted April 3, 2010 Oh duh lol, I was tweaking on this to get it to work and forgot to put the escape ; back in. Thanks for the help, knew it was something simple and obvious, just not to me at the moment lol. Quote Link to comment https://forums.phpfreaks.com/topic/197478-t_encapsed_and_whitespace-error/#findComment-1036494 Share on other sites More sharing options...
GetPutDelete Posted April 3, 2010 Share Posted April 3, 2010 Glad to help Just fyi the escapes are the backslashes (\) they let you maintain the same quotes inside of each other, for example if you wanted to do echo 'My name's Bob'; it would actually end the string in the word name's due to the quote. To get round this you do echo 'My name\'s Bob'; that way it will output My name's Bob. Quote Link to comment https://forums.phpfreaks.com/topic/197478-t_encapsed_and_whitespace-error/#findComment-1036496 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.