A certainl part of an if() structure never gets executed.
Νικόλαος Κούρας
support at superhost.gr
Wed Jun 12 08:39:53 EDT 2013
On 12/6/2013 2:49 μμ, F�bio Santos wrote:
>
> On 12 Jun 2013 12:08, "�������� ������" <support at superhost.gr
> <mailto:support at superhost.gr>> wrote:
> >
> > Oh my God!
> >
> > i just need to do this:
> >
> >
> > for i, month in enumerate( months ):
> > � � � � print('<option value="%s"> %s </option>' % (month, month) )
>
> Usually what goes in <option value="..."> is an ID of something. You
> should keep using (i, month) and then do months[id] to get the month string.
>
> Also, tuples aren't traditionally used for this. Normally you'd use a list.
>
You were right, i counter needed to signify the value: I just made it
work as i wanted to!
print('</select><select name="month">')
for i, month in enumerate( months ):
print('<option value="%s"> %s </option>' % (i, month) )
if month == '0':
month = '=========='
....
....
#
=================================================================================================================
# find & display requested info based on name/month/year criteria
#
=================================================================================================================
if( seek ):
try:
if '=' not in ( name or month or 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 or 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 )
More information about the Python-list
mailing list