Jump to content

A HREF - need to link files from data base. help please


applebiz89

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/>";

 

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.