For some reason I get the below error. Can someone find where this is going wrong?
Parse error: syntax error, unexpected T_IF in /home/www/mydomain(.)com/page_search.php on line 8
Here is the code
PHP Code:
<?php
+ // We urlencoded the whole search string so we need to
+ // urldecode and convert it back to utf-8
+ $id = $id === 0 ? '' : utf8_encode(urldecode($id));
+
I tried both way as below and replacing // instead of + but the error is same
PHP Code:
<?php
/** We urlencoded the whole search string so we need to
* urldecode and convert it back to utf-8
*/
+ $id = $id === 0 ? '' : utf8_encode(urldecode($id));
+
psalzmann, rafaelrls and Peter McDonald thanks for all and also thanks to others who commented this thread.
The problem solved by removing the + and replacing //.
I tried immediately when I show psalzmann's comment but I replaced // for all 4 + as below
PHP Code:
<?php
// We urlencoded the whole search string so we need to
// urldecode and convert it back to utf-8
// $id = $id === 0 ? '' : utf8_encode(urldecode($id));
Sorry I'm zero with PHP
After checking with some other PHP codes I tried replacing // first two lines then peter@flexiwebhost you remind me to try by removing the + in second and third line.
Corrected code
PHP Code:
<?php
/** We urlencoded the whole search string so we need to
* urldecode and convert it back to utf-8
*/
$id = $id === 0 ? '' : utf8_encode(urldecode($id));