Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRichard Hope
25,237 PointsUsing sqlite3 with my website.
Up until now I've been learning by building my own website and was using mysql as per previous tutorials on databases and php. I'd like to use sqlite3 with my website having seen this as my database will be very small and it seems like a better solution than mysql.
I've downloaded the sqlite3 files and put them in a folder on my c drive, have exported a table from excel and created a database using sqlite studio and that database is in my inc folder.
I can't work out how I start using the database with my console and the php doesn't seem to be linking to the database.
--code added--
<?php
require_once('../inc/config.php');
// remove before flight
ini_set('display_errors', 'on');
try { $db = new PDO('sqlite:' . ROOT_PATH . 'inc/pricelist.db'); var_dump($db); die(); } catch(Exception $e) { echo $e->getMessage(); die(); }
When i refresh my webpage it does show : object(PDO)#1 (0) { }
but when try to break the code by changing the filename it displays the same thing.
2 Answers
shezazr
8,275 Pointscan you do some research on whether sqlite is worthy of being a production database? just to be sure as i have heard to the contrary.
Richard Hope
25,237 PointsHi shez - I don't think its a problem for low traffic websites:
http://stackoverflow.com/questions/913067/sqlite-as-a-production-database-for-a-low-traffic-site
Corey Cramer
9,453 PointsCorey Cramer
9,453 PointsCan you please post the code you're currently using to try and connect to your database?