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 Quote 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>"; } Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/68840-solved-blank-search-results/#findComment-346036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.