craigjonson Posted August 15, 2009 Share Posted August 15, 2009 I have a search box on my website that searches the mysql database for members. I thought it was working great until I tried it in Internet Explorer. This is the problem, in IE when the search is successful (member is found in database) it displays nothing. What is weird though, is that if the search fails, (member does not exist) it displays the error message as expected. If anyone could take a look at my code below, and let me know if you have any suggestions it would be greatly appreciated. $query = "SELECT * FROM members WHERE username LIKE '%$word%'"; $numresults=mysql_query($query); $num_rows=mysql_num_rows($numresults); if ($num_rows != 0) { $result = mysql_query($query) or die("Couldn't execute query"); /* Display table with results */ echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><br>"; for($i=0; $i < $num_rows; $i++){ $uname = mysql_result($result,$i,"username"); $id = mysql_result($result,$i,"member_id"); echo "<td><a href=\"profile.php?id=$id\">$uname</a> </td><td><br>"; } echo "</table><br/><br>"; } else echo "No members found."; Quote Link to comment https://forums.phpfreaks.com/topic/170407-my-member-search-works-in-firefox-but-not-in-ie-what-gives/ Share on other sites More sharing options...
waynew Posted August 15, 2009 Share Posted August 15, 2009 You're not using the <tr> (row) tag by the looks of things. You also have a <br> tag just after the <table> tag. Quote Link to comment https://forums.phpfreaks.com/topic/170407-my-member-search-works-in-firefox-but-not-in-ie-what-gives/#findComment-898938 Share on other sites More sharing options...
ignace Posted August 15, 2009 Share Posted August 15, 2009 Don't use: $result = mysql_query($query) or die("Couldn't execute query"); What usefull information does "Couldn't execute query" contain for your visitors? Please post your entire code, what does $word contain? Quote Link to comment https://forums.phpfreaks.com/topic/170407-my-member-search-works-in-firefox-but-not-in-ie-what-gives/#findComment-898970 Share on other sites More sharing options...
craigjonson Posted August 15, 2009 Author Share Posted August 15, 2009 Thanks waynewex, I'll try that. $word contains a string. For example, $word = "craigjohnson". Quote Link to comment https://forums.phpfreaks.com/topic/170407-my-member-search-works-in-firefox-but-not-in-ie-what-gives/#findComment-898973 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.