Python 3.4 - passing information from mysql query output table to other page

I have a table (python code below) which prints out the results of a database query.  An image of the output table is also attached.

I need the NOM column to be 'live' so that the user can click on a name and be sent to another page - AND to have the persons MemberID also sent to that page. I've done this in  the past using coldfusion - which looks like this

<td><a href="actionPage.cfm?[b]memberID[/b]= #recordset1.[b]memberID[/b]#">#recordset1.[b]nom[/b]#</a></td>

Open in new window


My problem is to apply this structure to the python format as shown in the code below. Researched it on line but can't find any info.

Thanks for any help.



python table code

def displayAll_names(all_names):
      print("<table border='1'>")
      print("<tr bgcolor=#FCFFDA>")
      print("<th>Member_ID</th>")
      print("<th>civilities</th>")
      print("<th>Nom</th>")
      print("<th>PreNom</th>")
      print("<th>adresse</th>")
      print("</tr>")
      color = 1
      for each in all_names:
            if color is 1:
                  print("<tr bgcolor=#BED3BE>")
            else:
                  print("<tr bgcolor=#D0F5CF>")
            print("<td>{0}</td>".format(each[0]))
            print("<td>{0}</td>".format(each[1]))
           [b] print("<td>{0}</td>".format(each[2]))[/b] ================>  needs changing
            print("<td>{0}</td>".format(each[3]))
            print("<td>{0}</td>".format(each[4]))
            print("</tr>")
            if color is 1:
                  color = 0
            else:
                  color = 1

      print("</table>")	        
     

Open in new window





TABLE OUTPUT FROM DATABASETABLE OUTPUT FROM DATABASE
jameskaneAsked:
Who is Participating?
 
clockwatcherCommented:
We'd need to know the link that you want to go to but...

print('<td><a href="somepage.py?memberId={member_id}">{member_name}</a></td>'.format(member_id=each[0], member_name=each[2]))

Open in new window

0
 
jameskaneAuthor Commented:
Fantastic - got the live links on the names - just like coldfusion !!

jim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.