Jump to content

[SOLVED] blank search results


cs1h

Recommended Posts

Hi,

 

I am trying to gather search results from the following script, as far as I can tell it is finding the right amount of results but the results are blank.

 

<?

//connect to your database ** EDIT REQUIRED HERE **
mysql_connect("localhost","adder","clifford"); //(host, username, password)

//specify database ** EDIT REQUIRED HERE **
mysql_select_db("real") or die("Unable to select database"); //select which database we're using

$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<BR>n";
} else {
while($row = mysql_fetch_array($result)) {
echo "<img src=http://www.myroho.com/images/".$info['photo'] ."> <br>"; 
echo "<b>Article:</b> ".$info['Article'] . "<br> "; 
echo "<b>Email:</b> ".$info['Email'] . " <br>"; 
echo "<b>Abstract:</b> ".$info['Abstract'] . " <hr>"; 
}
}
?>

 

If anyone can help me it will be much appriciated.

 

Thanks

Colin

Link to comment
https://forums.phpfreaks.com/topic/68840-solved-blank-search-results/
Share on other sites

replace

while($row = mysql_fetch_array($result)) {
echo "<img src=http://www.myroho.com/images/".$info['photo'] ."> <br>"; 
echo "<b>Article:</b> ".$info['Article'] . "<br> "; 
echo "<b>Email:</b> ".$info['Email'] . " <br>"; 
echo "<b>Abstract:</b> ".$info['Abstract'] . " <hr>"; 
}

 

with

while($row = mysql_fetch_array($result)) {
echo "<img src=http://www.myroho.com/images/".$row['photo'] ."> <br>"; 
echo "<b>Article:</b> ".$row['Article'] . "<br> "; 
echo "<b>Email:</b> ".$row['Email'] . " <br>"; 
echo "<b>Abstract:</b> ".$row['Abstract'] . " <hr>"; 
}

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.