WingLeung
WingLeung

Reputation: 95

Zend fetchRow() not working

I'm trying to fetch a row with a where statement but for some reason it throws an error at me.

This is the line $row = $this->getDbTable()->fetchRow("order = $order");

I've put a die(); before this line and it does die, Then I've put a die(); after this line and the die() doesn't get executed but throws an error.

The error doesn't help me much it only says "An error occurred Application error", there's nothing in my php error log either.

Help!

Upvotes: 0

Views: 2980

Answers (1)

ChrisA
ChrisA

Reputation: 2091

Going by your comments, I would try doing the where part 'properly'? E.g.:

$select = $this->getDbTable()->select()->where('order = ?', $order);
$row = $this->getDbTable()->fetchRow($select);

What is the situation you are needing to select by order? Is there a primary key you can select by?

Update:

Given your comments, maybe use update directly:

$table = $this->getDbTable();

$data = array( 'order' => $order+1 );

$where = $table->getAdapter()->quoteInto('order = ?', $order);

$table->update($data, $where);

Upvotes: 1

Related Questions