1) {
$clause = implode("%", $array);
if ($like) $like .= " or";
$like .= " abstract like '%$clause%'";
$popped[] = array_pop($array);
}
$query .= $like.($like ? " or abstract like '%" : " abstract like '%").implode("%' or abstract like '%",array_merge($array, $popped))."%')";
$trimmed = trim($var); //trim whitespace from the stored variable
// rows to return
$limit=10000;
// privremeno zakomentirano
// check for an empty string and display a message.
if ($trimmed == "")
{
echo " Please enter a search string... "; exit; } // check for a search parameter if (!isset($var)) { echo "We dont seem to have a search parameter! "; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","edas","pass"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("edas") or die("Unable to select database"); //select which database we're using echo $query.""; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "Results"; echo "Sorry, your search: "" . trim($var) . "" returned zero results "; // google echo "Click here to try the search on google "; } $count=1; $result = mysql_query($query) or die("Couldn't execute query"); while ($row= mysql_fetch_array($result)) { $title = $row["papertitle"]; $broj=$row["paper"]; echo "$count Title:
$title" ;
echo ' (read
abstract / buy an article) |