Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post

    Problem with preg_replace/str_replace

    Hey guys..... can anyone see what is wrong with the below code?

    Code:
    $qs = str_replace('mode=advanced', 'mode=advanced_player', $_SERVER['QUERY_STRING']); // Line 135
    $qs = preg_replace('\player=[^&]+&\', 'player=' . $sid . '&', $qs); // Line 136
    I am getting the below error..

    Parse error: syntax error, unexpected T_STRING in /usr/www/virtual/brett/www.oncardauto.com/search.php on line 136

    Thanks!

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    PHP Code:
    $qs str_replace('mode=advanced''mode=advanced_player'$_SERVER['QUERY_STRING']); // Line 135
    $qs preg_replace('\player=[^&]+&\', 'player=' . $sid . '&, $qs); // Line 136 
    The syntax highlighter reveals the issue. Don't you need forward slashes there?
    PHP Code:
    preg_replace('/player=[^&]+&/''player=' $sid '&'$qs); 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post
    lol oops...... thx 4 that!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •