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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-09-2007, 02:33 AM
Junior Member
 
Join Date: Feb 2007
Posts: 26
Default Using Zend_Db_Table with multiple WHEREs

How to translate this mySQL query into Zend_Db_Table find() method ..

"SELECT * FROM `myTbl` WHERE `id`='$id' AND `email`='$email'"

Find() method only accept single WHERE.

Thanks a Lot.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-09-2007, 04:57 AM
Administrator
 
Join Date: Jan 2007
Posts: 12
Default

Hello,

You're sure you need find method ? And directly Zend_DB_Table ?

Cause i would personally go better for this:

$id = $db->quote($id);

$email = $db->quote($email);

$sql = "SELECT * FROM `myTbl` WHERE id=$id AND email=$email";

$result $db->fetchAll($sql);/Or fetchRow if needed


One advantage is you can just echo $sql to see if you get right SQL command, and also, sometime is usefull since you can test this query directly against MySQL database (through phpmyadmin maybe) to see if/why is not working properly. MySQL will give you then a better understanding on why is wrong your SQL syntax.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-10-2007, 02:23 AM
Junior Member
 
Join Date: Feb 2007
Posts: 26
Default

Yeah, I should have read the manual first before posting that question. :-D
Thanks,
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 05:40 AM.