...

View Full Version : Problem with preg_replace/str_replace



cyphix
12-13-2008, 10:02 AM
Hey guys..... can anyone see what is wrong with the below 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!

abduraooft
12-13-2008, 10:13 AM
$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?

preg_replace('/player=[^&]+&/', 'player=' . $sid . '&', $qs);

cyphix
12-13-2008, 05:20 PM
lol oops...... thx 4 that! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum