Page 1 of 1
How Come This Does Not Work?
Posted: Tue May 07, 2002 4:03 pm
by icesolid
Code: Select all
<?php
$array = array(@fopen("file.php", "r"));
if(in_array($query, $array, TRUE)) {
echo "Results were found.";
} else {
echo "No results were found.";
}
?>
The $query variable is coming from a form I have set up.
Posted: Tue May 07, 2002 4:14 pm
by samscripts
Hi, I'm assuming that you want to read a list of values from file.php into the array and then see if $query is in them?
You need to use:
to read the contents of a file into an array (of lines from the file)
Code: Select all
$array=array(@fopen("file.php", "r"));
creates an array containing 1 value, which is the return value of the fopen function. Which is probably not what you want to do.
Sam