System that can access database offline using PHP - php

Im currently developing a system using PHP and MySQL, what is required of the system is that it should allow the user be able to access the database on a standard GUI online (web browser) and should also be able to access the database offline, now can anyone help me with a method of how to make this possible.
The idea i have right now (me thinking out of the box) is using local host database manager like xampp which will be offline and an online database manager were the system will be hosted but cant figure out how will both databases be synchronized so that they stay the same.

If you want to have two databases maybe you will have to use a mirroring system. This one, wil help you to mantain the database syncronized with the database of the server with the local or not accessible database. You also can have a look at this link for more information Right way to mirror a PHP/MySQL setup

Related

Database manage using mobincube application wont let me add anything

I'm wondering if it is possible to add information to a database using an app developed in the mobincube platform, the idea is to create an application for android devices that let the user input some data, which should be saved to an online database, the problem is that when trying to do it using phpMyadmin or sqlite, this won't save any information, the app and coding doesn't show any error message, does anyone know why this happens? is it because those are local databases that are in the computer while the app requires a remote database connected to it?

Connecting a website to a database

I am sorry if this is the wrong stack exchange, if so please redirect me.
I am very much in doubt about how I go about the following, and I can't really seem to google my way to a solution, so here goes:
Let's say I have a website which basically only consists of a search bar, which I want to link up to a database which every user can search in. In addition to this I want to be the only one who can actually add new data to this database.
To do this, would I basically "just" buy a website domain, make some SQL query hookup to a database that I rent from fx Microsoft Azure? Then whenever people would search for a string the website would query the database and return any relevant information.
Is this the correct way to go about this issue?
For your scenario, I would suggest you use Azure App Service MySQL in-app, which has a cool feature for Web developers to create Web applications that use MySQL. You don’t need to provision a database explicitly as during the creation of the web app when using this feature.
For more details, please refer to Announcing MySQL in-app for Web Apps and Create a PHP web app in Azure.

in Openshift environment, how to access a database in a different application?

I have been trying to access a mysql in a jboss eap application from a wordpress application in Openshift environment. I followed this blog post on this subject and prepared a php file on the wordpress server with $dbhost, $dbuser, $password point to the database in my jbosseap app. Unfortunately, it did not work. Each time I got a "no route to host" error. However, if I point the database to that in the wordpress app, i.e. local database, it worked perfectly.
I am wondering if there must be additional step(s) to execute when the php script and the database are in different Openshift applications?
I've ha same problem following this guide https://blog.openshift.com/sharing-database-across-applications/,
the solution is writen even there:
Step 1: Create an application with a database
We will create a scalable PHP application using a MySQL database cartridge. In non-scalable applications, the database will be installed in the same
gear as the application. In this case we want the database to be accessible from other gears. So creating a scalable application ensures that the database runs in its own gear that can be accessed from other gears.
Here
http://www.hfaber.com/post/135256827109/openshift-sharing-database-across-applications
After talking to some people in Redhat, I concluded that it is not possible to share database accesses between different applications in Openshift environment. You may see some technical documents which show how to do it, but that is for Openshift/Redhat internet environments, not for regular customers of Openshift.
At the end, I used webservices to provide sharing of DB accesses between applications.
The investigation was in August 2015. Hope it will or has changed

Web based solution for Android app (SQLite) and Website Database (SQL) Sync

This topic has been raised a few times but even after searching and going through suggestions I haven't found a solution.
I have a PHP based website and an Android app that has to use the same database. The database is for an objective type test. The questions are created on the web using an admin panel.
The Android app needs to work offline so there is a need for one time sync when internet is available.
I have created a table in PHPMyAdmin called "database version". The Android app checks the database version using a web service. If the the version number is different it should be able to download the latest version of the database of the website and store it locally for offline access.
One of the suggestions I've come across is to convert the .sql database into .sqlite and give the download link of .sqlite to the Android app. However, converting .sql database to .sqlite using PHP doesn't seem to be easy. I've come across some shell script method but with no knowledge about that it probably doesn't work for me.
So, I'm looking for way to make sure the Android app can use the same database of the website but only require internet connection for syncing otherwise the app will work offline.
Would appreciate if I could get some directions and advise as to how to accomplish this.
Thanks!
Actually, I'm not sure If I would choose a solution that "replaces" the database when your app gets back online. I think I would build a database on the Android (SQLite), and synced with the Webdatabase (MySQL) row by row, by comparing datastamps.

What is required to build up a basic sqlite database server on my laptop

Thank you for the time reading this.
I am planning on creating an Android app that is communicating with my own SQLite database server\webpage that is located on my private laptop.
I have no previous knowledge/experience with PHP nor hosting a webpage in this case.
My question is what is required to make the most basic online database server so I could easily and very basically request and fetch SQLite queries within the Android app from the database that is on my laptop.
Are there any programs I have to own?
Also my first intentions is for it to work on my local network(My Wifi at home), and then make it global.
Any help is appreciated, Thanks.
What you want to do isn't possible. SQLite is used only as a local storage i.e. a file on the local PC that is being read from. In order to do what you want to do you would need to install a database server on your laptop. MySQL is probably best as this is free for personal use.
I'd suggest getting a VPS for like £6 a month and hosting a database on there. I use Chunkhost and they seem amazing for the price. There are many tutorials for setting up a MySql database on there and administering it.
I would also suggest making it a web application first before trying to integrate it with Android, that way you're learning one thing at a time and not 2 (php/mysql and then android integration).

Categories