Jump to content

Recommended Posts

As it stands; I can search the database with a given word in the form, and it will bring back all the files that, that word is in. However I want to after finding all the files with the word in, give a link to them files to view.

 

How could I go about doing this. This is my searcher file code.

 

-------------------------------------------------------------

$var = @$_POST['input'] ;

$trimmed = trim($var); //trim whitespace from the stored variable

 

 

$limit=10;

 

 

if (!get_magic_quotes_gpc())

{

$var = addslashes($var);

}

 

$query = "SELECT filename FROM webdata WHERE words LIKE '%" .$var."%' order by filename";

$result = mysql_query($query);

 

echo "<p>You searched for: "" . $var . ""</p>";

 

$num_results = mysql_num_rows($result);

 

echo '<p>Found: ' .$num_results; '</p>';

 

for ($i=0; $i <$num_results; $i++)

{

$num_found = $i + 1;

$row = mysql_fetch_assoc($result);

echo "$num_found. " .($row['filename']). "<br/>";

 

}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.