Basics for database

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Basics for database

Post by Opaquer » Mon Dec 28, 2015 1:01 am

Hi all

I'm making a POS system for work, and one of the things I'd like to do is make it connect to a database. I have no idea where to start with this - never done database stuff before at all, though in another post I made, someone suggested to use MySQL. Firstly, how would I make a MySQL server (I'm really new to databases), and secondly, is there a better option compared to MySQL?

Thanks in advanced

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: Basics for database

Post by ClipArtGuy » Mon Dec 28, 2015 1:18 am

If your database will be local, you can use SQL lite, if your database need to be accessed over the internet by multiple users, then MySQL is the way. Most hosting providers (such as on-rev) offer a "cPanel" which will greatly reduce the difficulty of setting up a MySQL database. Also, on-rev hosting comes with LiveCode server pre-intsalled, so you can easily write your "middleware" scripts in the language you are already working in. :D

If it is indeed an online (MySQL) database that you want, you will need a MySQL databse set up on a either a hosting provider or a server that you have physical access to. Once you have the databse set up on a server, you can start to learn how to connect to a MySQL database here:

http://lessons.livecode.com/m/4071/l/70 ... l-database

The above example is very basic and works, but is not secure. You never really want to hard code your database credentials into an application, so most people use some sort of "middleware"script, frequently written in PHP, but also easily written in LiveCode. This thread contains a good amount of information on this topic:

http://forums.livecode.com/viewtopic.ph ... middleware

I hope this was helpful enough to get you started.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Basics for database

Post by sphere » Mon Dec 28, 2015 3:32 pm

Hi,

you could also install Easyphp local on your computer(if your on Windows), this package contains Mysql server/PHP/apache server and your instantly good to go.
Also with this package there is phpmyadmin which you can use to easy setup a database with it's tables and columns.
http://127.0.0.1 will then be your server's address locally.

For Linux there are enough HowTo's to find on the web on how to install this, for Apple i don't know.

You can also install all separate so you know how it works together but that's a bit more difficult.

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: Basics for database

Post by Opaquer » Tue Dec 29, 2015 1:29 am

Thanks ClipArtGuy for the info! The issue is my workplace doesn't have a website or anything like that, so we don't have any hosting provider to go with unfortunately :(. They're really old school and don't know much about computers, and were surprised i could touch type :P. For SQL lite, can that store info over a local network? There might be a couple of computers if there's a few sales happening at once is all. And Sphere, I'll give Easyphp a try! Is there anything I need to know with that, or can I just download it, run the server and I'm good to go?

Thanks!

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: Basics for database

Post by Opaquer » Tue Dec 29, 2015 3:56 pm

Hey all! So, I've had a play around with EasyPhp, and so far it's looking like it might work, though I do have some questions. How do I get Livecode to connect to the database I have? The database at the moment is apparently the IP address 127.0.0.1 - isn't that just the standard home address (I'm really bad at this sort of thing). Wouldn't I need another IP address that any computer can connect to?

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Basics for database

Post by sphere » Tue Dec 29, 2015 11:10 pm

HI,
127.0.0.1 is just the standard server address

You need to setup a connection to the database which you first have to create using phpmayadmin
so in your browser go to 127.0.0.1\phpmyadmin
there you add a database and create a table in that database
in the table you create the columns you need like id,name,address etcetera
make sure you use utf8-generic for your columns and the first id clumns you could check AI for auto increment, then everytime you add something a new id will be created in the table
in livecode or php file you will have to connect to that database and table and insert, update or delete anything in a column

normally the server username is root with no password

Post Reply

Return to “Databases”