Hi, My search module does not work. It never returns any results. And I get the following error:

warning: Invalid argument supplied for foreach() in /home/aasg/public_html/includes/common.inc on line 700

I search for http://drupal.org/search/node/foreach%28%29+ and read many articles. The foreach() error apparently happens or use to happen with many modules. But I can't figure out what the solution is in case of the search module.

Can you please direct me if you know the answer?

Comments

Steven’s picture

Re: search, you're probably not indexing your site. Do some more searching.
--
If you have a problem, please search before posting a question.

leblank@cyberocity.com’s picture

I set up the hourly cron run. There's a file in your site that needs to be run regularly via the cron jobs called cron.php. After you run it all should be ok. You can run it by hand to kick it off by entering www.yursite/cron.php in the browser ..

cheers
---------------
LeBlank

Aleet’s picture

Thanks so much for your help. Search is working now after I ran cron.

But I'm still getting the following error:
warning: Invalid argument supplied for foreach() in /home/aasg/public_html/includes/common.inc on line 700.

Any ideas?

leblank@cyberocity.com’s picture

on a query to the database. Wait for a while till you develop some content for the query to bring back it'll go away.

If you really really really have to fix it then go to that line and find the query. The result should be named such and such like "$thisresult=do this query for who wears red socks on christmas on the database"

Then you'll see a "foreach($thisresult ... blah blah "
add a line before the foreach like "if($thisresult){ foreach($thisresultblah blah; }

Then it will only run the foreach if there is something in the result to work with.

have fun!
---------------
LeBlank

Aleet’s picture

Thanks so much.