On 11/06/2013 21:20, Νικόλαος Κούρας wrote:
[code]
if not re.search( '=', name ) and not re.search( '=', month )
and not re.search( '=', 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 re.search( '=', month ) and not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE
MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY lastvisit ASC''',
(month, year) )
elif not re.search( '=', year ):
cur.execute( '''SELECT * FROM works WHERE
YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', year )
else:
print('''<h2>Πώς να γίνει αναζήτηση αφού δεν επέλεξες
ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?''')
print( '''<meta http-equiv="REFRESH"
content="5;/cgi-bin/pelatologio.py">''' )
sys.exit(0)
data = cur.fetchall()
hits = money = 0
for row in data:
hits += 1
money = money + row[2]
......
......
selects based on either name, month, year or all of them
[/code]
The above if structure works correctly *only* if the user sumbits by form:
name, month, year
or
month, year
If, he just enter a year in the form and sumbit then, i get no error, but no
results displayed back.
Any ideas as to why this might happen?
On the grounds that you can't possibly have made a coding error I'd say
this is a Python bug which should be reported here bugs.python.org.
--
"Steve is going for the pink ball - and for those of you who are
watching in black and white, the pink is next to the green." Snooker
commentator 'Whispering' Ted Lowe.
Mark Lawrence
--
http://mail.python.org/mailman/listinfo/python-list