views:

1018

answers:

1

Hi, I wanted to know why is this code wrong.

new_query = "SELECT time,message FROM status WHERE (uid=%s % request.facebook.uid) AND  time > someval.time"
new_result = request.facebook.fql.query(new_query)

Someval.time is correct time format according to facebook time format. So why does it gives me wrong code??

new_query = "SELECT time,message FROM status WHERE (uid=%s % request.facebook.uid)

gives me correct value.

Thanks

A: 

Did you mean:

new_query = "SELECT ... AND  time > %s" % someval.time

or similar?

Edit:

You've posted several pieces of code that look like this:

"Select something WHERE x=%s % something"

with the percent operator and its argument both within the quotes. You need to do something like this:

new_query = "SELECT time,message FROM status WHERE (uid=%s) AND (time>%s)" % \
            (request.facebook.uid, someval.time)
RichieHindle
Sorry for late reply. And yeah I mean above query.new_query = "SELECT time,message FROM status WHERE uid=%s % request.facebook.uid AND time > %s" % someval.time
The code in your comment has two %s markers but only one value passed to the % operator. See my amended answer.
RichieHindle
Sorry My mistake...