Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-19-2007, 08:41 PM
Junior Member
 
Join Date: Sep 2007
Posts: 1
Default Simple query but where is problem?

Hi
I have simple query
PHP Code:
$q="SELECT *
FROM a 
LEFT JOIN b ON ida=idb
WHERE desc LIKE :rejected AND date :y 
ORDER BY :order"
;
$values=array(
':rejected' =>'rejected',
':y'=>'y',
':order' => $this->_request->getPost('order','date'),
);

$result=$db->query($q,$values); 
And it simply don't work
It looks that first two params are qoted ok.
But the third one not because the result has alwas same order.
But if i do this
PHP Code:
$q="SELECT *
FROM a 
LEFT JOIN b ON ida=idb
WHERE desc LIKE :rejected AND date :y 
ORDER BY '"
.$this->_request->getPost('order','date')."'";
$values=array(
':rejected' =>'rejected',
':y'=>'y'
); 
It works.Can somebody help me?
Thanks

PS: I apologize for my poor english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:01 PM.