Can you show the code you are now using and describe the workflow of how 
the record gets updated and how you are then attempting to view the updated 
record?

Anthony

On Monday, July 1, 2013 8:37:32 PM UTC-4, Ahmad Faiyaz wrote:

> weird things happening, when i check the db table with appadmin, it shows 
> for contest.running = yes [ updated the value with sqlform.grid ] , but 
> when i fetch the row with DAL on app, it shows contest.running = no [ which 
> is the default ]
>
> why ?
>
> On Tue, Jul 2, 2013 at 6:18 AM, Ahmad Faiyaz <faiy...@gmail.com<javascript:>
> > wrote:
>
>> thanks, but it sometimes work, sometimes doesn't !! what can be the 
>> problem !
>>
>> On Tue, Jul 2, 2013 at 5:34 AM, Alex <mrau...@gmail.com <javascript:>>wrote:
>>
>>> from the documentation:
>>> update_record should not be confused with
>>> >>> row.update(name='Curt')
>>> because for a single row, the method update updates the row object but 
>>> not the database record, as in the case of update_record
>>>
>>> so you should use update_record instead. or even better:
>>> db(db.contest.id == id ).update(running = value)
>>>
>>> which only results in one sql statement.
>>>
>>> Alex
>>>
>>> Am Dienstag, 2. Juli 2013 00:23:16 UTC+2 schrieb Ahmad Faiyaz:
>>>
>>>> Hello, 
>>>> i am trying to update a row on a db table, but it is not updating, what 
>>>> is the problem ?
>>>>
>>>> my db table definition:
>>>> db.define_table('contest', Field('name', length=128 ), 
>>>> Field('contest_host', length=128,), Field('duration', 'time' ), 
>>>> Field('time_passed','time', default = 0), Field('rank_frozen','time', 
>>>> default = 0), Field('running',length= 10, readable=False, default = "no"), 
>>>> Field('lang'))
>>>>
>>>> My update function:
>>>>
>>>> def flip_contest_status():
>>>>     id = request.post_vars.id
>>>>     row = db(db.contest.id == id ).select().first()
>>>>     value = "no"
>>>>     con =  row.running
>>>>     if con is "no":
>>>>         value = "yes"
>>>>     db(db.contest.id == id ).select().first().update(running = value)
>>>>     session.flash = row.name + " mode changed to "+ value
>>>>     return locals()
>>>>
>>>> it doesn't update my db row !! 
>>>>
>>>> What to do ?
>>>>
>>>>  -- 
>>>  
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/1YuETESUji8/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>
>>
>> -- 
>>
>> Regards,
>> Ahmad Faiyaz
>>
>
>
>
> -- 
>
> Regards,
> Ahmad Faiyaz
>  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to