On Wednesday 12 April 2006 22:52, Rafael Muñoz Moreno-Davila wrote:

> L'idée est la suivante: faire un systeme de note par page, en affichant

> une ou plusieurs image selon la note ex: note 4, 4 images (comme un 4

> etoiles quoi), et donc faire ça pour toutes les pages du site, on peut

> aussi voter et donc changer la note.

Il est tard et j'ai un peu les yeux qui se croisent a force de regarder mes propres problemes MySQL :-)

Je ne suis pas sure d'avoir compris... mais c'est sans doute moi... y'a des jousr comme ca :-)

Voici ma vision du probleme en Python... n'au plus pratique php depuis...

# conect to db etc. 'cursor' being the db connection

cmd = 'SELECT note FROM ' + table

cursor.execute(cmd)

# I manualy split the string to avoid the mailer to do it...

img = '<img src="">

img += 'alt="Title" height="18" width="23">'

# I assume SELECT result is a collection of 'int' !

for n in cursor.fetchall() :

cell = ''

# Loop n times to dump 'img' code

for i in range(n) :

cell += img

# I also assume it's embeded in a table

print '<tr><td>%s</td><td>%d</td></tr>' % (cell, n)

# The rest of the code is obvious...

dc

_______________________________________________
gull mailing list
[email protected]
http://lists.alphanet.ch/mailman/listinfo/gull

Répondre à