How do I include the database file with my login file ? When the user click login I want their info to go into the database so How do I include my database file with my login file ?
Are you trying to do a multipart uploads which is where you send info on top of a file? Your question is a little vague.
No I want to create a database connection 000webhost to my corona app . So my question is … How do I include my database file to my login file . Like in php you include your db.php with your signup.php and login.php
I found some stuffhttps://forums.coronalabs.com/topic/41746-connect-to-database-online/http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4582039-please-add-support-for-syncing-sqllite-to-mysql-se
You should probably just make your own rest api to talk to php which talks sqlhttp://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/
When I put the php code I am getting an error that says :
main.lua:1: unexpected symbol near ‘<’
Thanks but none of those answers helped me
I need some code. But it I where to spitball you are not suppose put php code in lua.
$lua = new Lua(); \<?php // CONNECT TO THE DATABASE $DB\_NAME = 'xxxxx'; $DB\_HOST = 'localhost'; $DB\_USER = 'xxxxx'; $DB\_PASS = 'xxxxx'; $mysqli = new mysqli($DB\_HOST, $DB\_USER, $DB\_PASS, $DB\_NAME); if (mysqli\_connect\_errno()) { printf("Connect failed: %s\n", mysqli\_connect\_error()); exit(); } $query = "SELECT \* FROM `news`"; $result = $mysqli-\>query($query) or die($mysqli-\>error.\_\_LINE\_\_); $json = array(); if(mysql\_num\_rows($result)) { while($row=mysql\_fetch\_row($result)) { $json[]=$row; } } echo 'Total results: ' . $result-\>num\_rows; echo json\_encode($json); mysql\_close($DB\_NAME); ?\>
So how will I connect to my app to the database
- You should not have a variable outside the php tags
2.You should put php file in website folder example
—hello.php
<?php
echo ‘hello’;
?>
—main.lua
network.request(“http://example.com/hello.php”, “GET”, function (e)
print(e.response)
end)
I get it now it’s kind of the same thing as android studio
network.request("http://example.com/hello.php", "GET", function (e) print(e.response) end) local function networkConnection( networkConnection ) if(network.request == true) then local storyboard = require "storyboard" storyboard.gotoScene("start") end end return scene
Is this code good to check if the app is connected or not ?
Are you trying to do a multipart uploads which is where you send info on top of a file? Your question is a little vague.
No I want to create a database connection 000webhost to my corona app . So my question is … How do I include my database file to my login file . Like in php you include your db.php with your signup.php and login.php
I found some stuffhttps://forums.coronalabs.com/topic/41746-connect-to-database-online/http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/4582039-please-add-support-for-syncing-sqllite-to-mysql-se
You should probably just make your own rest api to talk to php which talks sqlhttp://omnigeek.robmiracle.com/2012/04/15/using-corona-sdk-with-rest-api-services/
When I put the php code I am getting an error that says :
main.lua:1: unexpected symbol near ‘<’
Thanks but none of those answers helped me
I need some code. But it I where to spitball you are not suppose put php code in lua.