Standalone app access to a MySQL in LC server
Posted: Sun Jul 26, 2015 10:14 am
Hi all,
I'm just starting with LiveCode and have only few notions about coding, so my below questions are of begginer level.
I'm working on my first app and trying to access a MySQL database hosted in an LC server with no success.
Understood that, for security reasons some servers do not allow to directly access a database from outside. In accordance to what I've been able to understand after reading some posts in the forum, I must set a middleware in between my app and the database.
I've wrote this small php file to set my connection and to :
And I'm getting the following error messages:
The user 'user' has been duly activated in the MySQL by the cPanel.
My questions are:
- is this middleware a php file in my domine in the LC server?
- should it be placed in the 'public/html' folder in 'my domain' at 'on-rev''? or where?
- where can I find the host name were my database is located?
- what I'm doing wrong or not doing?
Any help is very welcome ... I'm desperate.
Thank you in advance from sunny Spain
I'm just starting with LiveCode and have only few notions about coding, so my below questions are of begginer level.
I'm working on my first app and trying to access a MySQL database hosted in an LC server with no success.
Understood that, for security reasons some servers do not allow to directly access a database from outside. In accordance to what I've been able to understand after reading some posts in the forum, I must set a middleware in between my app and the database.
I've wrote this small php file to set my connection and to :
Code: Select all
<?php
$hostname = "host";
$database = "database";
$username = "user";
$password = "password";
$connLivecode = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $connLivecode);
$query = "SELECT * FROM `table_name`";
$result = mysql_query($query, $connLivecode) or die(mysql_error());
?>
Code: Select all
( ! ) Warning: mysql_pconnect(): Access denied for user 'user'@'host' (using password: YES) in /home/anotion/public_html/exemple.php on line 7
Call Stack
# Time Memory Function Location
1 0.0001 228328 {main}( ) .../exemple.php:0
2 0.0001 229536 mysql_pconnect ( ) .../exemple.php:7
( ! ) Fatal error: Access denied for user 'user'@'host' (using password: YES) in /home/anotion/public_html/exemple.php on line 7
Call Stack
# Time Memory Function Location
1 0.0001 228328 {main}( ) .../exemple.php:0
2 0.0162 230392 trigger_error ( ) .../exemple.php:7
My questions are:
- is this middleware a php file in my domine in the LC server?
- should it be placed in the 'public/html' folder in 'my domain' at 'on-rev''? or where?
- where can I find the host name were my database is located?
- what I'm doing wrong or not doing?
Any help is very welcome ... I'm desperate.
Thank you in advance from sunny Spain
