Skip to first unread message

Mitchell Brits

unread,
Jul 17, 2014, 4:54:43 PM7/17/14
to mitappinv...@googlegroups.com
Hey,

I currently set up an app to register users by using fusion tables (they enter information like their name, surname, email and have a password as well as a username). I would like to know how I can read through all the data in my database to log the user in if they have registered.

Thank you :)

Taifun

unread,
Jul 17, 2014, 5:55:10 PM7/17/14
to mitappinv...@googlegroups.com
you can take a look at your Fusiontable in your Google Drive
https://drive.google.com/?authuser=0#my-drive

if you want read the table from App Inventor, do a SELECT query

have you already done the Pizza Party tutorial?
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Mitchell Brits

unread,
Jul 18, 2014, 12:36:33 AM7/18/14
to mitappinv...@googlegroups.com
Will the select query be appropriate for a login?

Yes, I did the Pizza Party tutorial that's how I learned to use the FusionTables :)

Taifun

unread,
Jul 18, 2014, 1:03:18 PM7/18/14
to mitappinv...@googlegroups.com
Will the select query be appropriate for a login?
sure
a user enters name and password into a textbox
then send a select statement like this: SELECT password FROM <tableid> WHERE name = 'name entered in name textbox'
now you can check the result:
1. if there is no row returned, i.e. the user name does not exist in the table, print an error message "user does not exist"
2. if a row was returned, now check, if the returned password is equal to the password entered in the password textbox
if no, print error message "password is wrong"

btw. normally it's not a good idea to store plain passwords in a table, a better solution is to encrypt them and compare the encrypted passwords then

Taifun

Mitchell Brits

unread,
Jul 18, 2014, 1:16:48 PM7/18/14
to mitappinv...@googlegroups.com
wow, awesome! I'll try that out and see if it works, Thank you Taifun! If i dont get it right I'll post here again :)

Enis

unread,
Jul 18, 2014, 1:39:34 PM7/18/14
to mitappinv...@googlegroups.com
Even if you DO get it right, make sure you come back up here and let us know either way, OK?

Mitchell Brits

unread,
Jul 18, 2014, 1:42:00 PM7/18/14
to mitappinv...@googlegroups.com
Haha definitely if you insist! It may be just a little while though since school is starting in 2 days time and I am busy with 2 HTML5 games too :)

Mitchell Brits

unread,
Jul 27, 2014, 1:03:47 PM7/27/14
to mitappinv...@googlegroups.com
Hey Taifun, 

I have this to check the username but it keeps giving me an error. I have tried putting a space and removing the space before SELECT and it still doesnt work. It looks like I have the spacing correct by FROM and WHERE but it gives me this error: 400 Bad Request: Parse error near &#39;;&#39; (line 1, position 76).

I know this error has got to do with my code but I dont understand where? Especially since there are no lines or positions.

Thanks for the help :) 
Screenshot 2014-07-27 18.56.36.png

Taifun

unread,
Jul 27, 2014, 1:07:09 PM7/27/14
to mitappinv...@googlegroups.com

Mitchell Brits

unread,
Jul 27, 2014, 1:45:57 PM7/27/14
to mitappinv...@googlegroups.com
Alrighty, I read through that, it gave me an even better understanding of how to use SQL statements, but I still cant figure out why it returns false.. The blanked out part is my table ID and I have tried multiple things to try and get them to compare. Using logic, text and Math and it still stayed false :/
Screenshot 2014-07-27 19.38.18.png

Taifun

unread,
Jul 27, 2014, 2:09:57 PM7/27/14
to mitappinv...@googlegroups.com
ok, your SQL statement currently is
SELECT 'Username' FROM <tableid> WHERE false
as you can see, this is not correct, do not use the = block, you have to write the complete statement using text blocks and variables like this
SELECT Username FROM <tableid> WHERE Username = 'get global username'
Taifun


Mitchell Brits

unread,
Jul 27, 2014, 2:41:47 PM7/27/14
to mitappinv...@googlegroups.com
Oh man and I was thinking it would be that X_X haha thank you! :) next is the password encryption authentication so I'll let you know if I run into any unsolvable problems :) Thank you!

Mitchell Brits

unread,
Aug 2, 2014, 6:46:04 AM8/2/14
to
Hey Taifun,

I am having a problem with the login again.  This time I managed to get a result for the username and it worked fine. I realised the way I was doing it would cause complications and after trying SELECT query for the password i keep getting this error: "table id, name and then it shows 2 of my databases id and names which use fusiontables but on separate apps? I checked my table id and my API key and it was the right one I am using. This made me realise that there must be a better way o do this. Such as getting the username using the select query but using the same row ID to check the password?

If you could please explain why I get this error and how to check the same row ID of the username for the password (if it is possible). Thank you :)

EDIT: It definitely happens when I use a select statement to retrieve the password. But I am using the same as the screenshot before except replaced Username with Password to try and check it.

Taifun

unread,
Aug 2, 2014, 9:41:38 AM8/2/14
to mitappinv...@googlegroups.com
I recommend you to read again my first answer in this thread how to do it...
Taifun

Mitchell Brits

unread,
Aug 2, 2014, 9:45:41 AM8/2/14
to
I did, and I did get the SELECT query right. But even though I duplicated it and changed the column to Password. It all of the sudden brought up that error.

EDIT: Nevermind, I looked at the screenshot and found my problem :P Set fusiontablesquery*1*  it should be 2
123456.PNG

Taifun

unread,
Aug 2, 2014, 9:46:40 AM8/2/14
to mitappinv...@googlegroups.com
SELECT password FROM <tableid> WHERE name = 'name entered in name textbox'
Taifun

Mitchell Brits

unread,
Aug 2, 2014, 9:53:22 AM8/2/14
to
Okay, I understand that to a certain point. Why look in the Password column and then the Username that way? I cant authenticate the password that way?

EDIT: Ooooooh okay I get it now :) It returns the password, that is really clever. Thank you so much Taifun!!
Reply all
Reply to author
Forward
0 new messages