KieronWiltshire Posted January 18, 2014 Share Posted January 18, 2014 So, I'm kinda new to MySQL and I know what a column/table is etc.. However I don't know some of the MySQL commands like SELECT, INSERT INTO, I was wondering if someone could send me a link to a decent documentation on MySQL commands please? Also how would I store encrypted passwords into a SQL database? Also how do I check the result of a query to see if the email exists in a database? Link to comment
toxicsmoke11 Posted January 18, 2014 Share Posted January 18, 2014 you got pretty much everything in here https://wiki.multitheftauto.com/wiki/Mysql Link to comment
KieronWiltshire Posted January 18, 2014 Author Share Posted January 18, 2014 No, I mean the SELECT FROM INSERT, that kinda stuff, where can I look this up? Also you know the dbPoll, how I use it to check if a user exists in a database... i.e --Check if the email already exists.. function emailExists(email) local query = dbQuery ( accountsDatabase, "SELECT * FROM users WHERE email=?", email ) local result = dbPoll ( query, - 1 ) if() then return true else return false end end how would I finish this code so I can check if the email exists, does dbPoll work like a for loop, does it look through each result, how can I check if email exists in database... Link to comment
Karuzo Posted January 18, 2014 Share Posted January 18, 2014 http://dev.mysql.com/doc/refman/5.0/en/select.html Link to comment
KieronWiltshire Posted January 18, 2014 Author Share Posted January 18, 2014 http://dev.mysql.com/doc/refman/5.0/en/select.html Thanks, but what about my 2nd question about finishing the query, can you help me there as well please? Link to comment
KieronWiltshire Posted January 18, 2014 Author Share Posted January 18, 2014 Can anyone please help me, I really want to get this finished by tonight if possible. Link to comment
TAPL Posted January 18, 2014 Share Posted January 18, 2014 --Check if the email already exists.. function emailExists(email) local query = dbQuery(accountsDatabase, "SELECT email FROM users WHERE email=?", email) local result = dbPoll(query, -1) if (result and type(result) == "table" and #result > 0) then return true else return false end end Link to comment
KieronWiltshire Posted January 18, 2014 Author Share Posted January 18, 2014 --Check if the email already exists.. function emailExists(email) local query = dbQuery(accountsDatabase, "SELECT email FROM users WHERE email=?", email) local result = dbPoll(query, -1) if (result and type(result) == "table" and #result > 0) then return true else return false end end It would be much appreciated if you could explain the if statement please, I would really like to know what's going on so I grasp it better. Link to comment
TAPL Posted January 18, 2014 Share Posted January 18, 2014 if (result and type(result) == "table" and #result > 0) then The if statement checks that the result aren't nil or false and it's a table and the table has one or more row. Link to comment
KieronWiltshire Posted January 18, 2014 Author Share Posted January 18, 2014 if (result and type(result) == "table" and #result > 0) then The if statement checks that the result aren't nil or false and it's a table and the table has one or more row. How should I store passwords? I would like to encrypt them to SHA1 or MD5 if possible Link to comment
xXMADEXx Posted January 18, 2014 Share Posted January 18, 2014 http://www.w3schools.com/php/php_mysql_intro.asp this could work for you. Link to comment
TAPL Posted January 18, 2014 Share Posted January 18, 2014 https://forum.multitheftauto.com/viewtopic.php?f=91&t=64966 A good website for the SQL functions: http://www.w3schools.com/sql/sql_insert.asp Link to comment
KieronWiltshire Posted January 18, 2014 Author Share Posted January 18, 2014 https://forum.multitheftauto.com/viewtopic.php?f=91&t=64966A good website for the SQL functions: http://www.w3schools.com/sql/sql_insert.asp So, now for my login function, would I also encrypt the password to MD5 on login and check the encryption from SQL and from login? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now