griffiths1983 Posted September 3, 2013 Share Posted September 3, 2013 Hello. I am one of the millions of noobs out there. I have a script designed to look up database and return search results to a table. The page however is blank so nothing is being output at all. Even the source is empty when I look at it. So the script starts with a simple index page to enter the search term and then submit. The search.php page then has the following parsed into the browser url = search.php?query=death&submit=Search I have tried searching google for all sorts of reasons for blank pages but none appear to help as they all appear to be unrelated. the script i am using on the search page is below, I want to learn so some pointers would be useful please. <?php mysql_connect("localhost", "user", "password") mysql_select_db("db") or die(mysql_error()); $query = $_GET['query']; $min_length = 1; if(strlen($query) >= $min_length) { $query = htmlspecialchars($query); $query = mysql_real_escape_string($query); echo "<table border='0' width='300' align='center'>"; echo "<tr align='center' bgcolor='#002C40' > <td height='35px' width='150px'>Title</td> <td>Author</td></tr>"; $raw_results = mysql_query("SELECT * FROM avathar15 WHERE (`user` LIKE '%".$query."%') OR (`alliance` LIKE '%".$query."%')"); if(mysql_num_rows($raw_results) > 0) { while($results = mysql_fetch_array($raw_results)) { echo "<tr align='center' bgcolor='#0f7ea3'> <td height='25px'>".$results['title']."</td> <td>".$results['text']."</td></tr>" ; } } else{ echo "<tr align='center' bgcolor='#6C0000'> <td colspan='2' height='25px'>No results</td> <tr>"; echo "</table>"; } } else{ echo "Minimum length is ".$min_length; } ?> Link to comment https://forums.phpfreaks.com/topic/281817-return-db-search-to-table/ Share on other sites More sharing options...
fastsol Posted September 3, 2013 Share Posted September 3, 2013 You need to turn on error_reporting so you can see why it's doing this. First thing I see is you are missing a ; at the end of the mysql_connect line. Link to comment https://forums.phpfreaks.com/topic/281817-return-db-search-to-table/#findComment-1447975 Share on other sites More sharing options...
griffiths1983 Posted September 3, 2013 Author Share Posted September 3, 2013 You need to turn on error_reporting so you can see why it's doing this. First thing I see is you are missing a ; at the end of the mysql_connect line. Thank you....even for a noob that was a bad miss on my part. The script is now executing Link to comment https://forums.phpfreaks.com/topic/281817-return-db-search-to-table/#findComment-1447976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.