0

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.

results.php

<html>
<head>
  <title>Book Finder Search Results</title>
</head>
<body>
<h1>Book Finder Search Results</h1>
<?php
  // create short variable names
  $searchtype=$_POST['searchtype'];
  $searchterm=trim($_POST['searchterm']);

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

  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.';
     exit;
  }

  $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>";
  }

  $result->free();
  $db->close();

?>
</body>
</html>
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by zizuno
0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.