Reputation: 167
first sorry for my bad english. i'm php programmer and I just started a python programming language.
Mysql code:
SELECT * FROM `datapy` ORDER BY `No` DESC LIMIT 0,1
And show row:
++++++++++++++++++
++ NO +++ nilai ++
++++++++++++++++++
++ 12 +++ 100 ++
++++++++++++++++++
in php it's very easy for select column and save as variable using:
$row = $takecolumn['nilai'];
What should I do if in python using mysqldb?
Upvotes: 0
Views: 347
Reputation: 542
you can create a database object like db
and use cursor()
cur=db.cursor()
cur.execute("select nilai from datapy ORDER BY `No` DESC LIMIT 0,1")
rows = cur.fetchall()
Upvotes: 1