cs1h Posted September 11, 2007 Share Posted September 11, 2007 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 More sharing options...
MadTechie Posted September 11, 2007 Share Posted September 11, 2007 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>"; } Link to comment https://forums.phpfreaks.com/topic/68840-solved-blank-search-results/#findComment-346015 Share on other sites More sharing options...
cs1h Posted September 11, 2007 Author Share Posted September 11, 2007 Thanks that worked just the way I wanted it too. Cheers Colin Link to comment https://forums.phpfreaks.com/topic/68840-solved-blank-search-results/#findComment-346036 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.