A certainl part of an if() structure never gets executed.
Νικόλαος Κούρας
nikos.gr33k at gmail.com
Tue Jun 11 16:20:52 EDT 2013
[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?
More information about the Python-list
mailing list