Hello everyone, having a slight problem with my php script.
When I run it on my apache server, it gives me this error message (there are no errors when i ftp the files to my school server):
Warning: Undefined offset: 1 in c:\program files\apache group\apache\htdocs\fsearch.php on line 19
I have commented line 19 out but it still gives me the same error. What's wrong and what can I do? Below is my php code:
<html>
<head>
<title>Keyword Search Results</title>
</head>
<body bgcolor="#000000" text="#00FF00" link="#FFFFFF" vlink="#999999" alink="#CCCCCC">
<h2>Keyword Search Results</h2>
<hr>
<?php
open the quotations file for reading
$filehandle = fopen("data.txt","r") ;
read the file one line at a time
while (!feof($filehandle)) {
read the lines in the file line-by-line
$buffer = fgets($filehandle, 1024);
# Split the lines into two variables $keyword and $watsthis. Use ";" as
# the separator
# list($keyword, $watsdis) = preg_split("/;/", $buffer) ;
# if $qkeyword (which came from the HTML form is found in $keyword,
# then print the line.
if (preg_match("/$qkeyword/",$keyword))
echo "<p>$keyword</p>" ;
}
close the file
fclose ($filehandle);
?>
</body>
</html>