I'm doing a generic App, that retrieves and processes some data from a MySQL database.
As the App will be selled multiple times, and i will provide to the user all access to the hosting / php's / databases, i'm searching for free webhosting services.
Most of them offers MySQL databases, and provide you a SQL_ServerURL, SQL_DatabaseName, SQL_DatabaseUser and SQL_DatabaseUserPass.
Ok, if i run all php's directly into the webbrowser, all works fine.
When i translate the URL to the NAB program using something like:
Code: Select all
document.getElementById('Container1').innerHTML='';
var destino = "http://mywebsite.com/myfolder/index.php";
$.get(destino, function(data,status){
document.getElementById('Container1').innerHTML='<div style="WIDTH:307px; HEIGHT:390px; overflow-y:scroll">' + data + '</div>';
},'text');
All my php's begins with:XMLHttpRequest cannot load http://mywebsite.com/myfolder/index.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Code: Select all
<?php
header("Access-Control-Allow-Origin: *");
...
...
?>
I had detected an small difference:
If i execute:
Code: Select all
$link = mysql_connect($dbserver, $dbuser, $dbpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($dbname) or die('Could not select database');
and this:
Code: Select all
$link = mysql_connect('localhost', $dbuser, $dbpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($dbname) or die('Could not select database');
Finally,
Does any know any free web hosting with MySQL databases that allow php's programs call MySQL databases directly at "localhost" AND NOT by another address ?
Thanks in advance,
David de Argentina