sql in livecode Username
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
sql in livecode Username
hi, how can i check from livecode if in the table UserName (of an Mysql database) there is already a record like that?
thanks!
thanks!
Samuele.
Re: sql in livecode Username
That is more a SQL question.
What is the name of the database field you need to check?
What is the name of the database field you need to check?
Re: sql in livecode Username
A database table has "fields" to store data in.
Example: A table "UserNames" may have these "fields": name, password, age, address
Capisce?
Example: A table "UserNames" may have these "fields": name, password, age, address
Capisce?
Re: sql in livecode Username
Yep, fetch these data and if they are empty then this name is not yet in the database.
SQL:
select * from UserNames where name = "you name here"
SQL:
select * from UserNames where name = "you name here"
Re: sql in livecode Username
yes, that's how i do it on SQL, but how do i tell livecode to do that, in other words how can i write a code on livecode that will check, on SQL, or in other words to make livecode speak with SQL
thakns!
thakns!
Samuele.
Re: sql in livecode Username
Take a look at this lesson:
https://lessons.livecode.com/m/4071/l/7 ... l-database
To learn more about the basics of LC, please check these stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html
https://lessons.livecode.com/m/4071/l/7 ... l-database
To learn more about the basics of LC, please check these stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html
Re: sql in livecode Username
thanks
this i saw already, that's how i started...Take a look at this lesson:
https://lessons.livecode.com/m/4071/l/7 ... l-database
Samuele.
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: sql in livecode Username
That lesson contains all needed information to fetch data from a MySQL database.this i saw already, that's how i started...
In short.
1. use revopenDatabase to connect to the DB
2. use revDataFromQuery to fetch the data using your sql statement
3. do whatever you want with the received data
4. use revCloseDatabase to close the database connection again.
Regards,
Matthias
Re: sql in livecode Username
hi, this gives me a syntax error any idea why?
thanks!select * from UserNames where name = "you name here"
Samuele.
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: sql in livecode Username
Code: Select all
select * from UserNames where name = "you name here"
Code: Select all
select * from UserNames where 'name' = 'you name here'
Btw. if you have phpMyAdmin installed on your webserver you could test your sql statements with that.
phpMyAdmin is a free web app for administration of MySQL Databases. If it is not installed by default on your webserver you can install it.
For me it's a great helper to check/test/debug my sql statements.
Many webservers offer a software installation menu where you can install additional packages. If this is not the case for your web hosting account then you can download phpMyAdmin here
https://www.phpmyadmin.net/downloads/