I want to develop a web page to show a google maps map and put markers with the information of a MySQL database.
The objective is to make a file "map.¿php?¿.html?¿.js?" which do that.
The file must be used in several environments, where they have local access to the database.
I´ve been searching information and I´ve seen that i need to install some web server(like XAMPP), but i can´t install in every computers or in every servers(and it isn´t safe for production environments).
Can I create a local web page that shows ÇMySQL data withouth installing anything else?(I can install a connector to MySQL if it´s needed.
You can put a single file on your own webserver wich connects with the MySQL database. After that write some JavaScript / jQuery in your HTML to do an AJAX call to the file created before.
None of your users will need an webserver, all data will be requested from your server.
You can do an HTML/Javascript file for display the google map without server (but you need internet connection) and php file on your server for get the data.
In your JS, you can call a distant server who contain the MySQL database and your markers.
Example, with jQuery :
$.ajax({
url : 'http://your_domain.com/your_script_php.php',
async : false,
success : function(response){
// Contain the response of the server :
console.log(response);
}
});
Related
Good day. I am new to flutter web. If someone can assist or point me where I can get the correct info I would appreciate it. I need to save data in mysql on the same server that the flutter web app is uploaded to. What I want to know is if I must do a http request even though the mysql and webapp is on the same server? I guess I need to create a .php file to post and fetch data from the mysql database. But if you are on the same server do you http to the .php or is there another way? Thanks in advance.
If you meant with "HTTP to MySQL", to directly from Front-end access MySQL through some Web-API, then no there is no such thing supported by MySQL.
But you can create your own Web-API Back-end (a .php script), which redirects requests to MySQL, and then Front-end only needs to communicate with said Back-end.
The Front-end may seem to be on same server,
but the Front-end logic runs on the user's Browser, which is far away from server.
I am using a simple log in page as a start page to my application. When details entered, the app will check details with an external mySQL database and come back to connect or give error message. I am doing all these via php and all files are with .php extension.
But how do I do this with PhoneGap? I read around and php is not recognized on PhoneGap and moreover I can no longer place my php files on the server side. All files are going to be compiled via phonegap build which would sit on the mobile device itself.
How do I connect to my external mySQL database for PhoneGap? Seen the following guide which does uses a php script. I tried and it is not working. I don't get how it would work anyway since I can't place my php script on a server side.
Guide
I'm not sure if I'm getting this right, but I'll try to describe what I do. I've got a file with JSON data in it, which is needed for a synology package server, so if I add the url to the package server of the synology nas it accepts it as Package Server and reads the packages. This all depends on the JSON file and I need to set DirectoyIndex of my Apache to this JSON file to make it work. The Downside now is, everyone accessing this url with a browser can directly look into this JSON file.
Can I somehow wrap or hide this json data but still have it used by the NAS Package Server. IE using a index.php or index.html showing some kind of webpage but having the json data transferred too, when accessing the page?
I created an app using PHP and it runs fine using the HTTP address in the Webview object.
When using locally, the PHP script does not work (putting all files in assets).
Is there a way for PHP pages to be loaded locally but to define the actual PHP part to be used at the webserver?
To clarify, all HTML content of the .php page will be used locally but when needed PHP code it will connect the webserver.
Thanks!
If you use a php content you should have Internet connection because php codes work on server side not local devices(some apk's install mysql+php in your android device but if you want to publish your apk this way wont work in all devices on local.)
Also if you want to make an offline project why dont you use javascript "To clarify, all HTML content of the .php page will be used locally"
Here you can download phpforandroid.apk to work on the local Click Here
To give a quick example of my question, consider the JS file provided by Google to capture Analytics data that we paste in our files. How does this JS file get all the data? I want to know how to create such JS files that I can give out to others who can then run it on their own websites and yet, store data on my website server. In short, they only copy the 1-2 lines of JS in their pages and all the intended functionality would run on their website, but the data will be stored on my web server database.
How can I attach the functionality to such a JS file? I mean, how can I tell the JS file whether to collect Analytic data or show a form, etc. I am using PHP for server side processing. I did not find any good information on this so far.
Edit 1:
I wanted to add that the functionality is NOT limited just to analytics. It could be even as simple as showing a contact form that sends email to recipients, etc.
Google Analytics has a client-side javascript file that the site-owner puts a reference to in their web page. When that javascript file runs, it collects information about the current page and then makes a request of Google's server with that information encoded in the request and Google's server records that information in their database. Because ajax calls are subject to the same-origin limitations, Google's request back to their server is actually for a GIF image with the data encoded in the URL.
Here's Google's explanation of how it works: http://code.google.com/apis/analytics/docs/concepts/gaConceptsOverview.html
To create something like this for your clients, you would have to create the appropriate javascript file, host it on your servers, give out the instructions for installing it into their web pages and create the right PHP scripts for recording the information that comes in when the GIF is requested (presumably, you'd have to do some web server configuration to get your PHP scripts to run on a GIF request too).
I think you can find the answer to your question here: How to send data to remote server using Javascript
In short, you'll be able to send data to another domain using JSONP. You can achieve this also with jQuery's, $.getJson method.
By inserting something like
<script src="http://myeviltrackingsite.com/track.js"></script>
the visitor's browser will ask your server for track.js. When asked your server will get a normal HTTP-Header from the visitor and of course his IP. This HTTP-Header contains all information you want like the visitor's language, the kind of browser he uses. To track the visitor's geo location you can use the visitor's IP address and do a reverse IP lookup. there are free geo location databases available.