Below is the code i am currently using to display the result of the search. At the moment i can only display text but i also must display images also. I really need to solve this problem asap. All advice would be helpfull but i want to avoid using the method of storing images on the server. I'd rather keep them on MySql.
Thanks
<?
$searchterm=$HTTP_POST_VAR
S['searcht
erm'];
$searchterm2=$HTTP_POST_VA
RS['search
term2'];
$searchterm= trim($searchterm);
$searchterm2= trim($searchterm2);
if (!$searchterm2 || !$searchterm)
{
echo 'You have not entered search details. Please go back and try again.';
exit;
}
$searchterm = addslashes($searchterm);
$searchterm2 = addslashes($searchterm2);
@ $db = mysql_pconnect('localhost'
, '', '');
if (!$db)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
mysql_select_db('World');
$query = "select * from countries where ".country." like '%".$searchterm."%' && ".event." like '%".$searchterm2."%'";
$result = mysql_query($query);
echo "<table border=0 cellpadding=5 valign=top>";
while ( $row = mysql_fetch_array($result)
)
{
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Continent</th>";
echo "<td>" . htmlspecialchars($row['con
tinent']) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Country</th>";
echo "<td>" . htmlspecialchars($row['cou
ntry']) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Event</th>";
echo "<td>" . htmlspecialchars($row['eve
nt']) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Location</th>";
echo "<td>" . htmlspecialchars($row['loc
ation']) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Date</th>";
echo "<td>" . htmlspecialchars($row['dat
e']) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Information</th>";
echo "<td>" . htmlspecialchars($row['inf
ormation']
) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
echo "<tr>";
echo "<td width=75></td>\n";
echo "<th>Weblink</th>";
echo "<td>" . htmlspecialchars($row['web
link']) . "</td>\n";
echo "<td width=75></td>\n";
echo "</tr>";
}
echo "</table>";
echo '</p>';
?>
Start Free Trial