MySQL, MySQL Workbench, MAMP, and Eclipse - php

I am an extremely under-experienced web developer who is attempting to create a website with a couple friends. The front end stuff is all taken care of and I have been assigned to handle the back end stuff. My background is Materials Engineering, so needless to say, my programming experience relative to back end web development is non-existent. The questions I am going to ask will likely be trivial, and might not make sense at all!
I am just going to try and gain any understanding of the dynamics between MySQL, MAMP, and Eclipse.
If I use the tools provided by MAMP (phpMyAdmin) to create databases, do I then have to incorporate code into our front end code to get it to talk to the databases?
Is MySQLWorkbench a viable option to create the databases? If it is, and I create the databases and extract the code for the databases, where would this code go?
I guess I am just trying to obtain general knowledge on how to create and incorporate databases with MAMP and eclipse, when using MySQL as a database. Again, I understand this is probably trivial, so I would appreciate any information that can be provided!
Thank you.

Firstly, eclipse is simply an IDE (Integrated Development Environment), rather it is a tool that can be used to help develop your code, make sure that you are following proper syntax, etc. It is not however, a replacement for knowing a programming language.
That said, MAMP (Mac, Apache, MySQL, & PHP) is an application stack. Macintosh being the operating system, Apache being the web server that serves up your web pages, PHP being the back end programming language that (potentially) compiles the pages that Apache Servers, and MySQL being the database from which PHP pulls the data from.
As far as creating your databases, PhpMyAdmin and MySQL Workbench are both tools for helping you accomplish the task of creating your databases, tables, and potentially inserting data into these tables. However, as mentioned above you will need to use PHP or some other language, to connect to these databases and pull the information. I highly recommend checking out the PHP MySQLi and PDO MySQL libraries.

Related

Connecting Android Studio to Web Service to SQL Server

i heard that the best way to connect android to sql server database is by creating web service around it. Is there any specific tutorial to create the web service?
Do we need install server like xampp for mysql or it will be just fine with sql server management studio?
What is exactly a web service? Connecting via post method to php is a web service?
What software i must use to make it work?
-android studio
-sql server management studio
-php written in notepad (?)
-apache tomcat?
anything else?
Sorry for bad english, Thanks
You gave us a very broad question.
I'll try to get you going.
First, a webservice can be a lot, but most often it is a server (php in your case) that uses SOAP.
Look up SOAP yourself to get the details, but it boils down to sending XML files to the server. The server then responds with something appropriate.
Here is a very short introduction with code, just to get the idea what it is about:
http://www.codeproject.com/Tips/671437/Creating-Web-Service-Using-PHP-Within-Minutes
The reason you want a wrapper around your database is this: You don't want to allow everybody to access your database directly. So you write a wrapper around it, that ONLY performs tasks you allow it to.
For example: Get all users in group x. Or: Update the birthday of userid 455.
etc. That way you control what goes in and out, and you only have to send some XML to get the job done. Your PHP script will take care of the actual database interaction.
Where you write your PHP in isn't very important. I would advice you to use at least an editor with syntax highlighting and UTF8 support.
Don't use Notepad.
Look up notepad++ if you want something better: Notepad++ can do that. If you take bigger projects you probably want to use a real IDE. (There are many for PHP)
Apache? Linux? Windows?
As long as you can run PHP, it is OK. If you are planning to use MSSQL Server from Microsoft, you will have an easier time if you run on windows. If you use mySQL, it doesn't matter too much.
I want to warn you: You seem to be pretty new to PHP (since you asked if Notepad is OK to develop in). This project might be a little over your head. :-)

Compiling PHP & MySQL to standalone windows or linux application

For the needs of my father's store, some time ago i developed an web application using PHP and MySQL. The application is used to manage the products in the store.
Now he told me that some friend of him wants to use the application in his store too, but it's little annoying for me to explain him how to prepare his computer for the system..
I found some ways to compile the code to .exe, but it was nowhere explained what to do with the database.
What is the best way to make it comfortable for running on other computers? Maybe i should change the database type and use some other database instead of MySQL?
SQLite is serverless, and is perfect for embedding on standalone machines.

MSSQL -> MySQL or PostgreSQL DB replication

I find myself in a situation that someone else must have got stuck in at some point.
Our company runs an in house MSSQL based database, our website then sits on an external server and currently runs MySQL. The problem comes that both databases need to communicate with each other increasingly often.
Our current solution involves SSIS packages but they are tempromental and often slow. We end up very often having to drop tables on our live production server before then rebuilding them from the in house server. Of course this is leading to data inconsistencies so we try and perform these operations outside of peak hours. However, this leads to 24hr delays in some data being transferred from MySQL to MSSQL and then an additional 24hr delay in getting it back to MySQL. None of this is ideal.
What I am looking for is a solution that will allow replication between our in-house MSSQL server and any database that can sit upon a linux box and play nicely with PHP. As I said, we currently run MySQL so we have a preference to any solution that would include that but all other suggestions would be greatfully received.
I've read somewhere that PostgreSQL is a vialbe solution but I am now struggling to find where I read that. I've come accross a few tools that might help such as DBMoto and Slony-I, does anyone have any experience of either in such a situation?
Alternatively, are we simply barking up the wrong tree altogether and should we be trying to integrate MSSQL into our PHP environment?
Any thoughts or suggestions would be gratefully recieved.
Many thanks
Rob
The best solution that i know and i have used for this kind of job is SymmetricDS .
SymmetricDS is an asynchronous data replication software package that
supports multiple subscribers and bi-directional synchronization.
You can access MSSQL servers from PHP using FreeTDS and the mssql_* family of functions (or classes built thereon, or alternative freetds-using extensions). We use this for our admin application, with a Linux/PHP website talking to a MSSQL database.

How to sync mysql db between 2 localhost?

i want to develop some php stuff with a friend together. We managed to sync our local projects with an subversion repository on unfuddle.com and with subclipse. Now we need to now how to synchronize the local mysql databases, too. (We both use xampp and we want to use Mysql Workbench to mange the tables)
It's not an option for us to use an online database, because we want to able to write and test code offline.
I'm really a noob at mysql dbs, i just know how to let my php work with them.
so a programm or a eclipse plug-in which could let use the unfuddle repository would be perfect.
Thank you very much,
Someonelse
First of all, it's a bad idea to share a development database. It makes it very difficult to get consistency when other people may be modifying your data. It will very likely interfere with your thought process while coding.
I would recommend adding your database schema (or snapshots) to the svn repository and load them on each database instead. Once you get more comfortable with this, you can start looking at using an ORM like Propel to manage your database schema and preferably a whole framework like Symfony as well.
Now, if you're really stubborn about doing this (and a little crazy too) If you're in the same LAN, look at master-master replication.. It might work remotely too, but depending on the amount of data being read/written it might be really laggy. Again, you'll likely end up having problems regardless of what route you go with if you decide to share a single db.
Cheers!

stand alone php app

What is the best way to build a non web browser stand alone php app that works with some sort of database without requiring the user to install a database server. Or am i just asking too much?
If you're targeting Windows, try WinBinder. It allows you to develop native Windows applications using PHP.
It also supports SQLite, so you don't need a database server.
Embed the SQLite database in your app, then configure PHP to talk to the SQLite database:
http://us.php.net/sqlite
Have a look at php compilers, you'll end up with a binary for people to run. It could be a desktop GUI application, or a "web server in a box" type of thing.
bamcompile
phc
roadsend
I'd suggest you try miniPHP. It is basically an IDE around Winbinder; it lets you concentrate on writing PHP while it takes care of details like compiling the application. You can create either GUI or command-line apps and it works just fine with both SQLite and MySQL. It has a preview mode and some debugging capabilities too.
Here is an idea: information can be stored in XML and thus usage of database can be avoided. That will work only for certain kind of purposes of course.
As Oakcool has mentioned, check out PHP-GTK. It is a GUI development tool on the similar lines of MFC for C/C++.
PHP-GTK alongwith SQLite or a text file as others mentioned above should do the trick.
Take a look at this 3 links
PHP GTKenter code here
http://gtk.php.net/
FLEX
http://www.adobe.com/products/flex/?promoid=BPDEQ
AIR
http://www.adobe.com/products/air/
I think any those will help you, check it out.
I don't have any experience with it but there's a portable version of XAMPP.
You wouldn't necessarily have to use the Apache portion. The app could just run from the command-line, depending on what you're trying to do.
I dont know how to use PHP as standalone programming language, I mean without using a web server and a browser.i can answer your other question.
SQLite is a database system(to be more specific: a library!) which provides you all the basic capabilities of SQL database without needing to install any specific database servers.But you do need to copy a small .dll file(sqlite3.dll i suppose) into your working dirctory.The file is only a very small one,but you get all of the basic capabilities of a database such as INSERT DELETE UPDATE SELECT etc..Its a great light weight database..i mean it..really lightweight.
also PHP has inbuilt support for SQLite database.so compatibility will never be a problem
Have a look at their home page https://sqlite.org/
This is what they describe themselves:SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world.
Checkout phpdesktop that gives you:
Embedded web browser based on Chromium framework let you benefits from HTML5, javascript and jQuery.
Embedded web server with mongoose let you use php.
embedded database engine with SQLite.

Categories