I receive the correct results when I use Microsoft Internet Explorer. However, when I use Ubuntu and try to get the output, I receive a blank screen except for the title "Book Finder Search Results" which appears at the top.

Are there any adjustments I can make, so I can make it work with Ubuntu? Thanks.


  <title>Book Finder Search Results</title>
<h1>Book Finder Search Results</h1>
  // create short variable names

  if (!$searchtype || !$searchterm) {
     echo 'You have not entered search details.  Please go back and try again.';

  if (!get_magic_quotes_gpc()){
    $searchtype = addslashes($searchtype);
    $searchterm = addslashes($searchterm);

  @ $db = new mysqli('localhost', 'root', 'password', 'books');

  if (mysqli_connect_errno()) {
     echo 'Error: Could not connect to database.  Please try again later.';

  $query = "select * from books where ".$searchtype." like '%".$searchterm."%'";
  $result = $db->query($query);

  $num_results = $result->num_rows;

  echo "<p>Number of books found: ".$num_results."</p>";

  for ($i=0; $i <$num_results; $i++) {
     $row = $result->fetch_assoc();
     echo "<p><strong>".($i+1).". Title: ";
     echo htmlspecialchars(stripslashes($row['title']));
     echo "</strong><br />Author: ";
     echo stripslashes($row['author']);
     echo "<br />ISBN: ";
     echo stripslashes($row['isbn']);
     echo "<br />Price: ";
     echo stripslashes($row['price']);
     echo "</p>";



Recommended Answers

All 3 Replies

Is this on your local machine or on a web host?

I am using Microsoft Windows. On the Windows side, the files are in my wamp/www/ folder. I ran everything fine with mysql/php using WAMP under the Windows side. The results print out fine.

My issues are with Ubuntu. I am trying to get it working Ubuntu using VMware Player. On the Ubuntu side, the files are located in /var/www/.

I am using the same computer. My main OS is Windows, I have Ubuntu on VMware Player.

For URL, I am typing..

http://localhost/Reunion/search.html ===> brings up the search webpage that allows you to search authors in the database

At the search page, I have a form that allows you to search for author names etc. I type in the name and click search and the result is the .php file is blank.

It doesn't do that with Microsoft Windows using Internet Explorer. I tried it Opera and Firefox under UBuntu.

You have to install mysql or whatever version you are using. Enable php errors at the top of the page and it will tell you your exact problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.