kreut Posted February 12, 2011 Share Posted February 12, 2011 Hello, Can someone please tell me the correct syntax to delete a row with 2 conditions, using the Zend delete() method? I'd like to delete any row in assignment_questions where rows have a specific combination of question_id and assignment_id. Here's what I've come up with: $dbWrite->delete('assignment_questions',("question_id = $question_id" AND "assignment_id = $assignment_id"); Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/227476-deleting-on-2-conditions/ Share on other sites More sharing options...
thehippy Posted February 13, 2011 Share Posted February 13, 2011 AND is being used as a logical operator and not as a string being passed to SQL, there's an extra parenthesis in there too. $dbWrite->delete('assignment_questions',("question_id = $question_id" AND "assignment_id = $assignment_id"); Try something along the lines of this... $dbWrite->delete('assignment_questions', array( 'question_id' => $question_id, 'assignment_id' => $assignment_id ) ); Quote Link to comment https://forums.phpfreaks.com/topic/227476-deleting-on-2-conditions/#findComment-1173501 Share on other sites More sharing options...
kreut Posted February 13, 2011 Author Share Posted February 13, 2011 Thanks for the help with the syntax! Quote Link to comment https://forums.phpfreaks.com/topic/227476-deleting-on-2-conditions/#findComment-1173626 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.