php+mySQL integration
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
php+mySQL integration
Hi,
i am a php/mysql dev and would like to move all my php/mysql apps to integrate with LiveCode so that i can access my apps from Windows OS and android/iphone tablets and smarphones with a cool GUY without the need to open up any url in no matter what browser? Can you tell me how to accomplish that so that i have to dig into that? Also do i need to create the CSS with media queries so that all will be resized along if the user X visits the site using a smaller or larger mobile device?
Any additional information about this would be appreciated too.
Thanks.
i am a php/mysql dev and would like to move all my php/mysql apps to integrate with LiveCode so that i can access my apps from Windows OS and android/iphone tablets and smarphones with a cool GUY without the need to open up any url in no matter what browser? Can you tell me how to accomplish that so that i have to dig into that? Also do i need to create the CSS with media queries so that all will be resized along if the user X visits the site using a smaller or larger mobile device?
Any additional information about this would be appreciated too.
Thanks.
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Contact:
Re: php+mySQL integration
Hi,
If you have a PHP script on your server then you can call it with a command like:
(obviously alter the names to suit your requirements)
This would put the "print/echo"'d output from the PHP script into the variable "mydata" in LC - no web page or browser involved.
To use this process best would require you to plan your outputs from PHP to be in some raw data format (e.g. Comma or Tab separated lines of data. Or binary base64 encoded. or whatever) and develop some very simple functions in LC to make the call to the server and process the results into arrays or usable variables.
After that you simply use the data within your LC app just as if it had been generated in LC in the first place.
e.g. An example PHP part:
in LC:
I hope the above makes a bit of sense - please let me know how you get on or if you need clarification.
Cheers,
Dave
If you have a PHP script on your server then you can call it with a command like:
Code: Select all
put URL( "http://yourserver.com/yourscript.php?par1=abc&par2=123") into mydata
This would put the "print/echo"'d output from the PHP script into the variable "mydata" in LC - no web page or browser involved.
To use this process best would require you to plan your outputs from PHP to be in some raw data format (e.g. Comma or Tab separated lines of data. Or binary base64 encoded. or whatever) and develop some very simple functions in LC to make the call to the server and process the results into arrays or usable variables.
After that you simply use the data within your LC app just as if it had been generated in LC in the first place.
e.g. An example PHP part:
Code: Select all
<?PHP
define("TAB", "\t"); // useful little tip
if($_REQUEST['par1'] == 'acc')
{
print myBalFunction( $_REQUEST['par2'] );
}
function myBalFunction( $accno )
{
$accname = dbCallGetAccountName( $accno ); // or whatever database thing you might want to do ;)
$q = dbCallGetAccountBalance( $accno );
return 'Hello '.$accname.TAB.'You have '.$q.' credits in your account.';
}
?>
Code: Select all
// in the stack script (for example)
function getAcc pAcNum
put URL( "http://yourserver.com/yourscript.php?par1=acc&par2=123") into mydata
split mydata by tab
return mydata
end function
// elsewhere (on a card or button or ??)
put getAcc( 5678 ) into mybalance
put my balance[1] into field "hellomessage"
put my balance[2] into field "accountcreditmessage"
Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
Re: php+mySQL integration
hi,
i thought it is somehow easier like this: put URL . My app runs ok so why do i need to create any other like you said? I just want to have a gui outside the app so that i can let it run on ioS / android and Windows without the need of a browser etc. Maybe to execute the whole script inside the gui.. i do not know how to explain better. That's why i asked if the device X visited by user X is smaller then 640 / 480 for example do i need to create and use any CSS media queries to show properly my app. Thanks.
i thought it is somehow easier like this: put URL . My app runs ok so why do i need to create any other like you said? I just want to have a gui outside the app so that i can let it run on ioS / android and Windows without the need of a browser etc. Maybe to execute the whole script inside the gui.. i do not know how to explain better. That's why i asked if the device X visited by user X is smaller then 640 / 480 for example do i need to create and use any CSS media queries to show properly my app. Thanks.
Last edited by kbasedata on Mon May 20, 2013 8:34 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 328
- Joined: Mon Dec 05, 2011 5:34 pm
- Contact:
Re: php+mySQL integration
I posted an answer to what you wrote - if you didn't write it in a way that could be properly understood then don't complain.
I "Think" you are probably referring to the use of the internal "Browser" object (revBrowser on Windows, mobileBrowser on devices) - you can't really display any server supplied HTML output without using a browser! The internal Fields in LC do not support the full range of HTML commands.
I think you need to study the dictionary more and look at the lessons on the runrev site.
But more importantly get a friend who can write better English to explain what you want so the people on this forum can understand better. A "Guy" is a person (Male usually), but a "GUI" is a Graphical User Interface - there is a big difference!
I "Think" you are probably referring to the use of the internal "Browser" object (revBrowser on Windows, mobileBrowser on devices) - you can't really display any server supplied HTML output without using a browser! The internal Fields in LC do not support the full range of HTML commands.
I think you need to study the dictionary more and look at the lessons on the runrev site.
But more importantly get a friend who can write better English to explain what you want so the people on this forum can understand better. A "Guy" is a person (Male usually), but a "GUI" is a Graphical User Interface - there is a big difference!
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.
Visit http://electronic-apps.info for released App information.
Re: php+mySQL integration
ok than. Is there a way to integrate all i want to accomplish or not? I do not want to add any other code to LC or my php scripts.. i just want to have a cool gui and in that way the user doesn't have to enter any urls etc.. just password/username to log in the php/mysql app.
Re: php+mySQL integration
Hi,
Regardless of the front-end interface you're using, you will have to provide the software with a URL. Be it the browser, LiveCode, a Java app or Objective-C. As a developer, you need to put the URL somewhere into your code. The advantage for the user is that the user won't notice that there is something like a URL and that your PHP-scripts seem to be seamlessly integrated with the front-end interface.
I don't understand how you can say "don't want to add any other code". You'll have to add code to make the interface work, to connect to the server, to display the data, etc. I have a feeling that you're looking for a way to get something extremely cool without having to write code. I guess, the only way to do that is to send me a message and ask me for a quote
Kind regards,
Mark
Regardless of the front-end interface you're using, you will have to provide the software with a URL. Be it the browser, LiveCode, a Java app or Objective-C. As a developer, you need to put the URL somewhere into your code. The advantage for the user is that the user won't notice that there is something like a URL and that your PHP-scripts seem to be seamlessly integrated with the front-end interface.
I don't understand how you can say "don't want to add any other code". You'll have to add code to make the interface work, to connect to the server, to display the data, etc. I have a feeling that you're looking for a way to get something extremely cool without having to write code. I guess, the only way to do that is to send me a message and ask me for a quote

Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode