sql and sqlite questions

Thanks!
So I should turn it to SQlite. Still I don’t understand how it can be updated on the server? if it uses MySQL.

Not sure if I’m following, you said you did not have to update server right?

No, I need it to be possible to update. It’s an app for cookbook site, and the ability to add new entries is essential.

But you said:

Anyway, if this is a cooking app that displays up to date recipes from a server then the normal method is not storing the entire online database locally but rather set up a REST service on the server that your app can use to get the appropriate recipes to display to the user. Something like this: http://coronalabs.com/blog/2012/11/20/how-to-download-json-data-from-mysql-using-corona-sdk/

I mean that the new entries are added on the server by admin, but not in the app by the user. 
I’ve seen this tutorial and probably will implement.

But I thought the db should be added locally anyway, because there are tons of recipes.

Syncing local DB with online DB will not be a trivial task though. But some sort of caching would be optimal I guess. But that would still happen after user has downloaded the recipes usually. Not preload the app with entire db.

But I would definitely start with just the ability to display a single recipe gotten from a REST API, that would be a good start. 

Then later work out how to display multiple recipes in a tableview. That could be cached to a JSON file for example and only updated when server lets you know something is new.

I’m implementing the tutorial now. When I put the php on my own server and then try to execute it (the database is on another server) it goes:
Warning : mysql_connect(): Host ‘xxxxx.net’ is not allowed to connect to this MySQL server 

I tried uploading the database to the server with the php file and I got this error:
Warning : mysql_connect(): Access denied for user ‘xxxxxx’@‘localhost’ (using password: Yes)
Any ideas?

server to server connects are tricky. First off the server running mysql might have firewall rules protecting it against remote connections. You need to provide your IP to that server’s admin and ask them that connections from your server’s IP is allowed. Then they also need to allow remote connections to their MySQL server and finally they need to create a MySQL user for you with connection rights from your IP address. Then you should configure your php script to use that MySQL user id etc. 

If you run MySQL on your server where the php is also running then its a little simpler. You need to look at creating a user with the correct rights. 

I have to also mention at this point, if you are going to run mysql on your server and run php etc you might as well look into Coronium.io search this site and google). It does so much more than mysql to lua bridging but just that feature alone will make it worth your time investigating it. 

Best of luck!!!

Thank you all, I’ve managed to make it work. 
Yet, some of the data is in Cyrillic and Corona as well as sqlitemanager shows it as ???
PHPMyadmin shows the data right.
I suppose the problem is with json. Any ideas on how to make it encode/decode other characters than Latin?

Great news!!! As for Cyrillic, set your mysql db to be UTF8. You may need to drop tables, recreate them and then import data again with the db set to UTF8. Hope this helps.

I’ve done it but it doesn’t work.
I’ve found this example http://forums.coronalabs.com/topic/47669-reading-arabic-text-from-mysql-via-json-gives/?p=246615
I’ve added this mysql_query(“SET NAMES ‘utf8’”); to my php and now the ??? transformed to encoding like this \u0443\u0440\u043e.

1)There are other steps in the example. For example, collocate table in the Mysql file, I’ve tried but I don’t know how to do it exactly. My table: 

CREATE TABLE `dle_category` ( `id` smallint(5) NOT NULL AUTO\_INCREMENT, `parentid` smallint(5) NOT NULL DEFAULT '0', `posi` smallint(5) NOT NULL DEFAULT '1', `name` varchar(50) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO\_INCREMENT=51;

Where should I put something like DEFAULT COLLATE utf8_general_ci; ?

2)Another question: in the example I mentioned  some code shoul be added to php file
 

\<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /\>

when I add it and run the file, it generates an error. How should it be added?

Sorry, for all the questions, I’m a real noob in php and Mysql:(
 

I’ve found how to collocate automatically through phpmyadmin and I changed it to utf8_general_ci
Still not working.

It works!
I’ve changed everything to UTF - 8, collocated the database automatically to utf8_general_ci; 
and added this 

header('Content-Type: text/html; charset=utf-8');

above my code in php file. Corona still displayed ???, but I went to project sandbox and deleted the SQLite file. It created the new file and now cyrrilic characters are displayed normally.
Thanks for your help.