php - what's wrong with this simple fetch PDO statement? -
what's wrong pdo code? doesn't give me results although there results in tip
table in database.
try{ $this->pdo = new pdo( "mysql:host=".zconfig::read('hostname').";dbname=".zconfig::read('database'), zconfig::read('username'), zconfig::read('password'), zconfig::read('drivers')); $this->pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); $stmt = $this->pdo->prepare("select tip_text tip product_id=:product_id , item :which"); $stmt->execute(array(':product_id' => $id, ':which' => $which )); $row = $stmt->fetch(pdo::fetch_assoc); if($row['tip_text']!='') echo $row['tip_text']; else echo ""; } catch(pdoexception $e) { echo 'error: ' . $e->getmessage(); }
and can print out final query pdo executes? (parameters included)? variables $id
, $which
correctly populated above.
Comments
Post a Comment