I am not sure my title is obvious, sorry.

I've installed Apache 2.2.21, MySQL 5.1.61, phpMyAdmin 3.4.9 and php 5.3.5 individually on a single machine and also have encounter a bug.

This bug is created with this code:

if ($doSearch) {
  $hash = md5($q);

  //change code from PHP4 to PHP5 Search::getFromHash obsolete
  $searchh = new Search();
  if (false === ($search = $searchh->getFromHash($hash))) { // search doesn't exist
    $time_start = microtime(true);

    // create the search
    if (false === ($search_id = $searchh->create($q))) {
      die("error with search (1)");

Here's function getFromHash:

function getFromHash($hash) {
global $dbh;

$sth = $dbh->prepare("SELECT * FROM `searches` WHERE `hash` = :hash LIMIT 1");

$sth->bindValue(':hash', $hash);

if ($sth->execute()) {
  if ($sth->rowCount() == 1) {
    return $sth->fetch(PDO::FETCH_ASSOC);
  }
}

return false;}

Here is function create:

function create($terms) {
global $dbh;

$hash = md5($terms);

$sth = $dbh->prepare("INSERT INTO `searches` (`hash`, `terms`)
                             VALUES (:hash, :terms)");
$sth->bindValue(':hash', $hash);
$sth->bindValue(':terms', $terms);
if ($sth->execute()) {
    return $dbh->lastInsertId();
}

return false;} 

However, this code works perfectly on XAMPP 1.7.4 that is utilizing the same version of php 5.3.5.

I've modified the php.ini file so those are the same however i cannot discover why within an XAMPP atmosphere this code works during a stand alone atmosphere is doesn’t.

I ought to say, I did not write this code. I'm very new at php and was simply requested to maneuver this technique to a different machine.

I'd be very grateful for just about any assist in either fixing the bug around the new installation or re-creating it around the XAMPP installation in order to try fixing it.

If there's anymore info you'll need tell me.