Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Doctor_GLaDOS

Python and MySQL result conversion

Recommended Posts

Posted · Original PosterOP

Hola!

I'm currently making a Python Tkinter app as a personal project, however I've hit a road block🏴‍☠️. The program inputs an entry into MySQL query which then spits out the result as a Label.

image.png.c382920c8e86a20510023cc98bb928f6.png

:x

You enter a name and it prints out: "ID name email". So it works great, but I need those values as separate variables. I could just access the data with 3 SQL queries but thats just awful. 🤖

What I need is some kind of a string function that will use the result variable and create three variables or better, a list with [ID,name,email].

❤️❤️❤️

I appreciate all input. I didn't include the source code because it doesn't really matter here. A general solution or a point in the right direction will be more beneficial for me, as I will be able to learn and adapt it for my needs.

Link to post
Share on other sites

I don't quite understand your question. However, if you don't know the SQL commands, you can use

codecademy.com

That has a course on SQL. Just don't pay for anything haha.

 

It might help you better understand how SQL operates. Complete the whole course. It's quite short.

 

If I'm reading it correctly... you are trying to access an entry in your database & it's giving you all the information about it instead of only a specific variable in the entry.

If this is the case, you are using the "Select" statement incorrectly.

 

 Select * from table

is using the wildcard and showing all elements.

It's been a while since I used SQL but you need to use a few extra keywords.

 Select email from table where name is "jan"

My syntax is probably incorrect, but I think that's something along the lines of what you may need.


Don’t take any of my posts seriously. 

 

LTT Fan Fiction:

 

PC game list: 

 

Link to post
Share on other sites
Posted · Original PosterOP
2 minutes ago, fpo said:

I don't quite understand your question. However, if you don't know the SQL commands, you can use

codecademy.com

That has a course on SQL. Just don't pay for anything haha.

 

It might help you better understand how SQL operates. Complete the whole course. It's quite short.

 

If I'm reading it correctly... you are trying to access an entry in your database & it's giving you all the information about it instead of only a specific variable in the entry.

If this is the case, you are using the "Select" statement incorrectly.

 

 


 Select * from table

is using the wildcard and showing all elements.

It's been a while since I used SQL but you need to use a few extra keywords.

 


 Select email from table where name is "jan"

 

My syntax is probably incorrect, but I think that's something along the lines of what you may need.

Really appreciate your reply and it's a good idea. My SQL is rudimentary and a course might only do me good :) 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×