Forum Moderators: coopster
"Parse error: parse error, unexpected T_VARIABLE in /home/virtual/site39/fst/home/eislam/public_html/search/search.php on line 2"
i made a little changes in code,
<? php
$source = fopen("datafile.txt", "r");
$repeated = fread($source, fileSize("datafile.txt"));
fclose($source);
preg_match("/#[^#]*$word[^#]*/",$source,$result);
echo $result[0];
?>
and using the url like this,
[mysite.com...]
<?php
$word = $_REQUEST['word'];
$source = fopen("datafile.txt", "r");
$repeated = fread($source, fileSize("datafile.txt"));
fclose($source);
preg_match("/#[^#]*".$word."[^#]*/",$repeated,$result);
echo substr($result[0],1);
?>
Your error: a space between <? and php "<? php"
My error 1: search was within $source not $repeated
My error 2: forgot to remove the leading # from the output
Let me know if you still have problems