Search problems... :(

From: Date: Sun, 13 Jul 2003 15:13:03 +0000
Subject: Search problems... :(
Groups: php.db 
Request: Send a blank email to php-db+get-29215@lists.php.net to get a copy of this message
A form passes variable "$chiave" to result.php RESULT.PHP CODE: -------------------------------------------------------------------------------- <? include("top_foot.inc.php"); include("config.inc.php"); top(); $db = mysql_connect($db_host, $db_user, $db_password); if ($db == FALSE) die ("Error, Verify settings in config.inc.php"); mysql_select_db($db_name, $db) or die ("Can't select database. Verify settings in config.inc.php"); $keys = explode (" ", $_POST ["chiave"]); $query = ""; foreach ($Keys as $single_word) {$single_word = trim($single_word); if ($single_word != "") $query .= "titolo LIKE '%$single_word%' OR testo LIKE '%$single_word%' OR autore LIKE '%$single_word%' OR "; } $query .= "'0'"; $query = "SELECT id, titolo, data FROM news WHERE " . $query; $result = mysql_query($query, $db); while ($row = mysql_fetch_array($result)) { echo "<a href=\"view.php?id=$row[id]\">" . date("j/n/y", $row[data]) . " - $row[titolo]</a><br>"; } foot(); ?> -------------------------------------------------------------------------------- Everything goes right till foreach ($Keys as $single_word) that RETURNS: Warning: Invalid argument supplied for foreach() in c:\programmi\apache group\apache\test\prova\result.php on line Do U know why? Thanks in advance Marco

« previous php.db (#29215) next »