I've got two environments using the same bit of code. The two environments aren't matched up perfectly (nothing I can do about that immediately). It works fine in one but fails in the other, despite the fact the same data is in both tables. I've tried messing around with the formatting some, generally created more errors than I solved. One is running 5.0.95 mysql and the other is running a 5.5.29. What's the syntax difference between the two that I'm missing, and how can I make it complaint with both?
// Code I can easily edit for reasons starts here
$sql = <<< SQL
SELECT WIDGET FROM TABLE WHERE FOO=:foo AND BAR=binary(:bar);
SQL;
// Code I can easily edit for reasons ends here
// Code I can't reliably mess with for reasons starts here
$db = pdo_dbopen();
$pdo = $db->prepare( $sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY) );
$pdo->bindValue(":foo", "kitten");
$pdo->bindValue(":bar", "hugs");
print_r($pdo); // First Print
$pdo->execute();
$my_info = $pdo->fetch(PDO::FETCH_ASSOC);
print_r($my_info); // Second Print
I can't put the print_r on the other server, but on the non-functioning one (at First Point), shows...
PDOStatement Object([queryString]=> SELECT WIDGET FROM TABLE WHERE FOO=:foo AND BAR=binary(:bar);)
For the second print print, I get just an empty result, despite confirming the value is there in phpmyadmin.
I feel maybe this should be populated with the bind values, and I don't know why it's not in one version but it is in the other?