Problem selecting photos
Posted: Mon Sep 17, 2007 10:27 am
pickle | Please use
If any one can help me work out how to do this it would be much appriciated.
Cheers
Colin
pickle | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
I have a search script for my databases and I want it to be able to get a certain picture from a folder on the server that is relevent to its country and type. For example if someone selects germany and news it should gather the germanynews.png pic.
This is my script so far,
[syntax="php"]<?
mysql_connect("localhost","xxx","yyy");
mysql_select_db("real") or die("Unable to select database");
$keywords = preg_split("/[\s,]+/", trim($_POST['keyword']));
$sql = "SELECT * FROM items WHERE country='" . mysql_real_escape_string($_POST['menuFilesDMA']) . "' AND type='" . mysql_real_escape_string($_POST['Type']) . "' AND Abstract LIKE '%$keyword%'";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows == 0) {
echo "No results please try a different <a href=asearch.html>search</a>.";
} else {
while($row = mysql_fetch_array($result)) {
echo "<img src=http://www.myroho.com/searchthumbs/$Country$Type.png> <br>"; // <---I want this line to get the picture--->
echo "<b>Name:</b> ".$row['name'] . "<br> ";
echo "<b>Email:</b> ".$row['Email'] . " <br>";
echo "<b>Country:</b> ".$row['Country'] . "<br> ";
echo "<b>Type:</b> ".$row['Type'] . " <br>";
echo "<b>Title:</b> ".$row['Title'] . "<br> ";
echo "<b>Abstract:</b> ".$row['Abstract'] . " <br>";
echo "<b>Article:</b> ".$row['Article'] . " <hr>";
}
}
?>
Cheers
Colin
pickle | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]