MySQL Forums
Forum List  »  Connector/Python

Dissecting a query using Python
Posted by: Warren Baker
Date: April 25, 2005 10:33PM

Hi!

I am porting a function library app I wrote in PHP to Python. At work they
only use Python. I've researched how to connect to a MySql database using
Python, and how to retrieve rows. However, I am wondering how to do the
following:

I can do this in Python => $da=MYSQL_QUERY("select * from prefs where
user_name='$user_name' ");
I can do this in Python => $peek=mysql_fetch_array($da);

I cannot do the following:
$title =$peek[4]; //title window
$logic =$peek[5]; //logic window

So I basically wish to dissect the row from a query that returns a single row, and I'd like to be able to put the pieces of the array into variables.

Can anyone shed light on this?

Thanks very much!

Cheers!

-Warren

Options: ReplyQuote


Subject
Written By
Posted
Dissecting a query using Python
April 25, 2005 10:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.