2009年8月1日星期六

[fw-db] fecthing data with option

Hello all

I have data coming from text box and select box.

<select name="choice">
                          <option  label="cg1a" value="MMT_Number">MMT Number</option>
                          <option  label="cg1a" value="BOM">BOM Number</option>
                          <option  label="cg1a" value="CIN">CIN Number</option>
                        </select>

I am trying to fecth result regarding the choice of user.

In the controller

$filter = new Zend_Filter_StripTags();
$material= $filter->filter($this->_request->getPost('material')); //data coming from input text.
$choice = $filter->filter($this->_request->getPost('choice'));//data from select box.

I set the object
$searchDatabase = new Model_DbTable_MMT();
$where = $choice . '=' . $material
$this->view->searchDatabase = $searchDatabase->fetchAll($where);

Bu no success. Everytime I get MySQL synax error.

Exception information:

Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '')' at line 1


When I check the trace

IndexController.php(34): Zend_Db_Table_Abstract->fetchAll('MMT_Number= ')

Now as you can see in the trace and said in error message, it is a syntax error. I tired several ways to write where clause but no success. Can you guys please give your advises?


Best Regards

Erdal YAZICIOGLU
System & Network Engineer
Page Europa S.R.L - General Dynamics
www.pageuropa.it
Office - Rome : +39 0650395292
Mobile -Rome : +39 3490787196
Mobile -Istanbul: +90 536 3447989

没有评论: