Sorry, didn't notice you already provided the delete sql in your
original email. It's still early. Anyways, that is not the same as
what you are asking zend_db to do. Zend DB will create something like
this:

"DELETE FROM old_passwords874 WHERE Date_of_Changing = dateval"

What you might want is:

$db->query('DELETE FROM old_passwords874 WHERE username=? ORDER BY
Date_of_Changing ASC LIMIT 1',$user);


Mark

On Mon, Jun 15, 2009 at 8:50 AM, salma rayan<[email protected]> wrote:
> I used       $sq="DELETE FROM 'old_passwords874' WHERE username='$user'
> ORDER BY Date_of_Changing ASC LIMIT 1";
> it works in php my admin but it doesnt work with Zend,
> it needs to be quoted because it has a value from the datebase like
> 13/5/1988 for example
>
>
> On Mon, Jun 15, 2009 at 5:38 PM, Mark Wright <[email protected]>
> wrote:
>>
>> What is the normal sql delete query that you used? Does $dateval need
>> to be quoted?
>>
>>
>> Mark
>>
>> On Mon, Jun 15, 2009 at 8:00 AM, salmarayan<[email protected]> wrote:
>> >
>> > I want to delete a row from the database, when a certain condition
>> > occurs
>> > so I made a query
>> > $db= Zend_Registry::get('db');
>> > $sql="SELECT Date_of_Changing FROM old_passwords874 WHERE username =
>> > '$user'
>> > ORDER BY Date_of_Changing ASC LIMIT 1";
>> > $result=$db->fetchCol($sql);
>> > $dateval=$result[0];
>> > $n= $db->delete('old_passwords874','Date_of_Changing ='.$dateval);
>> >
>> > The Select query gets the results, but the delete doesnt work there is
>> > an
>> > error with the where condition of the delete query.
>> > i tried the nomral sql delete query
>> > $sql="DELETE FROM 'old_passwords874' WHERE username='$user' ORDER BY
>> > Date_of_Changing ASC LIMIT 1";
>> >
>> > But it doesnt not work with Zend, Please Help.. Thanks in advance.
>> > --
>> > View this message in context:
>> > http://www.nabble.com/Delete-Query-doesnt-work-with-Zend-tp24035172p24035172.html
>> > Sent from the Zend Framework mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>>
>> --
>> Have fun or die trying - but try not to actually die.
>
>



-- 
Have fun or die trying - but try not to actually die.

Reply via email to