I'm trying to make a search engine by watching a tutorial, exactly copied every code but in the middle of the tutorial I'm stuck, The guy Alex from PHPacademy smoothly goes off, but I cant proceed for this error. Please HELP!
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in Y:\wamp\www\SearchEngine\search.php on line 27
$button = $_GET['submit'];
$search = $_GET['search'];
echo "You didn't submit a keyword";
echo "search term is too short";
echo "You searched for $search<hr size='1'>";
//Connect to our Database
mysql_select_db("searchengine") or die(mysql_error());
$get = mysql_query("SELECT * FROM 'search'");
while ($result = mysql_fetch_assoc($get)) <<<<----------------------LINE 27--------------------------
$search_exploded = explode(" ",$search);
foreach(search_exploded as $search_each)
Remove the quotes from around the table name on line 26.
Though for future reference that error means the query failed.
Also, if your searching a table it would probably be best to use a where clause and/or full text searching. Though I'm not entirely certain what your trying to achieve considering your definition of search looks to be selecting all the data in table. When mine is to limit the data in a table based on a certain set of criteria.