sakthidas
sakthidas

Reputation: 69

PHP with SQLite in TItanium

Hi all am using Titanium studio for Desktop Development in PHP,

when i tried to connect with sqlite3 it shows an error msg as

uncaught exception with message unable to open databasefile

where the code supplied is

$db = new SQLite3('sample.db');

and another trouble is I was unable to acess $_GET, $_POST, and $_REQUEST in php Desktop Development using Titanium

Upvotes: 0

Views: 352

Answers (2)

Julio Aguilar
Julio Aguilar

Reputation: 21

I was pulling my hair with this. Seems like you can use PDO connections for mysql and also use SQLite3 for SQLite. (at least for SKD 1.2.0.RC4 , not sure on any other previous versions)

Check what the phpinfo(); function returns, try to find this string "sqlite3 SQLite3 support => enabled". If you phpinfo returns this, it means you can use the SQLite3 class.

If it does work, take a look here http://www.php.net/manual/en/sqlite3.open.php and let us know how it goes for you. For me this worked just fine and I can open, insert and select without problems. Try to use at first a full path for your db just for testing.

As for the $_GET, $_POST, and $_REQUEST, you are right, they are not available unless you load php pages with get params in the same string ("login.php?user=me&pass=secret"), in that case, the $_GET variable does become available. Not the best way to go but its an option. You can also create a data class and use it for holding and passing data among php pages, during your execution time.

Upvotes: 2

Muhammad Zeeshan
Muhammad Zeeshan

Reputation: 8856

You should use Titanium.Database.open to open db:

var db = Titanium.Database.open("Path to your db");

Upvotes: 0

Related Questions