barayne / phpdesktop

Automatically exported from code.google.com/p/phpdesktop
0 stars 0 forks source link

Demonstration of Database usage #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have seen the PDO example, but I personally use mysqli for database 
connections.

Would it be possible if you could provide basic examples on using mysql/mysqli 
also?

Thanks for this great project, keep up the great work!

Original issue reported on code.google.com by hawkyhaw...@googlemail.com on 13 Jan 2014 at 9:12

GoogleCodeExporter commented 9 years ago
mysql_*/mysqli_* family functions are (as their name suggests) ONLY for 
connecting to MySQL databases, and not for SQLite.

See http://www.php.net/manual/en/book.sqlite.php - For using SQLite
See http://www.php.net/manual/en/book.sqlite3.php - For using SQLite 3

So in short, you are going to need to use different functions, rather than 
mysql/i_* family.

With Regards!

Original comment by Daghostm...@gmail.com on 13 Jan 2014 at 10:52

GoogleCodeExporter commented 9 years ago
You misunderstand me. I was thinking of implementing a mySQL database, instead 
of using SQLite.

However, I feel using SQLite would be a better option, and would decrease 
overheads, memory usage, cpu usage etc.

Thanks

Original comment by hawkyhaw...@googlemail.com on 13 Jan 2014 at 12:55

GoogleCodeExporter commented 9 years ago
The mysql, mysqli, pdo_mysql extensions are included and enabled by default in 
phpdesktop binaries. You can use PDO to connect to mysql and use the same API 
functions that are on the UsingSQLite wiki page 
(https://code.google.com/p/phpdesktop/wiki/UsingSQLite). Just replace this line:

    PDO_Connect("sqlite:$db_file");

With this:

    PDO_Connect('mysql:host=localhost;dbname=test', $user, $pass);

I've updated the UsingSQLite wiki page with that example of connecting to mysql.

See the PHP documentation for more:
http://www.php.net/manual/en/pdo.connections.php

Original comment by czarek.t...@gmail.com on 13 Jan 2014 at 2:07

GoogleCodeExporter commented 9 years ago
Thanks very much for your speedy response.

Once again, thanks for this great project, keep up the good work!

Original comment by hawkyhaw...@googlemail.com on 13 Jan 2014 at 2:13

GoogleCodeExporter commented 9 years ago
Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/phpdesktop/issues/54

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 3:22