Jump to content

Recommended Posts

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%')
?>

Link to comment
https://forums.phpfreaks.com/topic/197478-t_encapsed_and_whitespace-error/
Share on other sites

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%\'');
?>

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.