views:

45

answers:

1

I am trying to run this simple SELECT query using PDO::MySQL, but it does not return a value, as you can see from the dump $row returns false, which means there was an error.

The database connection works, as I'm writing to the database a few lines further down

Sql query is correct

Can someone see the bug in this code? If you can I'd really appreciate it, as this has been annoying me for hours


$statement = $DbConn->prepare("SELECT id FROM mineral_index WHERE typeID = :typeID AND systemID = :systemID");
$statement->bindParam('typeID', $this->typeID, PDO::PARAM_INT);
$statement->bindParam('systemID', $this->systemID, PDO::PARAM_INT);
$row = $statement->fetchObject();

echo "<p><pre>";
$statement->debugDumpParams();
var_dump($statement->errorInfo());
var_dump($this->typeID);
var_dump($this->systemID);
var_dump($row);
echo "</pre></p>"; 

dump:


SQL: [76] SELECT id FROM mineral_index WHERE typeID = :typeID AND systemID = :systemID
Params:  2
Key: Name: [7] :typeID
paramno=-1
name=[7] ":typeID"
is_param=1
param_type=1
Key: Name: [9] :systemID
paramno=-1
name=[9] ":systemID"
is_param=1
param_type=1
array(3) {
  [0]=>
  string(5) "00000"
  [1]=>
  NULL
  [2]=>
  NULL
}
int(35)
int(30000142)
bool(false)
+1  A: 

$statement->execute(); ?????

Mark Baker
doh, had to be something stupid. I'm blind >_<
Thomas Winsnes
AT my age, I'd call it a senior moment.... but irrespective of age, it's a sympton of MMS (Monday Morning Syndrome) :-)
Mark Baker