User Profile

Collapse

Profile Sidebar

Collapse
sithlordkyle
sithlordkyle
Last Activity: Mar 27 '12, 10:31 AM
Joined: Dec 9 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • sithlordkyle
    replied to MySQL Select, from tuple to list
    Actually, I figured it out myself...

    Code:
    for n in range(0,75):
      cursor.execute("SELECT row FROM table WHERE column = %s ORDER BY column ASC", (n))
      result = cursor.fetchall()
      List = list()
      for t in result:
        List.append(int(t[0]))
      List = ",".join(map(str,List))
      ListUpdate = cursor.execute("UPDATE table SET column = %s WHERE column = %s",
    ...
    See more | Go to post

    Leave a comment:


  • sithlordkyle
    replied to MySQL Select, from tuple to list
    Glenton, thanks for the response. I actually got it to give me the list without the L in it. But that's half the thing. I need to dump those numbers back into a list and insert that list into a MySQL database.

    I think that PHP will provide a better solution than Python at this point.
    See more | Go to post

    Leave a comment:


  • sithlordkyle
    started a topic MySQL Select, from tuple to list

    MySQL Select, from tuple to list

    Hopefully I can explain this correctly. I am trying to take a MySQL select statement, get the output into a list, then upload that list back to the MySQL server.

    Code:
    cursor.execute("SELECT stuff FROM place WHERE thing = 3 ORDER BY track_id ASC")
    This spits out a tuple of integers ...

    ((1L,), (2L,), (3L,), (4L,), (5L,), (6L,), (7L,), (8L,), (9L,), (10L,), (11L,))

    ... with an 'L' following...
    See more | Go to post
No activity results to display
Show More
Working...