On 12/06/2013 12:17, Νικόλαος Κούρας wrote:

As with most of your problems you are barking up the wrong tree.
Why not use the actual value you get from the form to check whether you
have a valid month?
Do you understand why "0" is submitted instead of "=========="?

Bye, Andreas

I have corrected the enumerate loop but it seems thet now the year works
and the selected name nad month fail:

                if '=' not in ( name and month and year ):
                        cur.execute( '''SELECT * FROM works WHERE clientsID = 
(SELECT id FROM
clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) =
%s ORDER BY lastvisit ASC''', (name, month, year) )
                elif '=' not in ( month and year ):
                        cur.execute( '''SELECT * FROM works WHERE 
MONTH(lastvisit) = %s and
YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', (month, year) )
                elif '=' not in year:
                        cur.execute( '''SELECT * FROM works WHERE 
YEAR(lastvisit) = %s ORDER
BY lastvisit ASC''', year )
                else:
                        print( '<h2><font color=red>Πώς να γίνει αναζήτηση αφού 
δεν επέλεξες
ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?' )
                        print( '<meta http-equiv="REFRESH"
content="5;/cgi-bin/pelatologio.py">' )
                        sys.exit(0)


i tried in , not in and all possible combinations. but somehow it
confuses me.

doesn't that mean?

                if '=' not in ( name and month and year ):

if '=' does not exists as a char inside the name and month and year
variables?

i think it does, but why it fails then?

You think it does, but you're wrong.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to