SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: SQLIte Creating a Databse
-
Oct 29, 2007, 05:24 #1
- Join Date
- Jan 2007
- Posts
- 296
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
SQLIte Creating a Databse
I am trying to use SQLite to create a simple database however I just can’t seem to get it to work. I am using the code supplied when I first downloaded SQLite. I am also unsure what should come after the blob data type?? Like after a char I have (100) is there something that needs to come after blob???
Cheers for any help
Code:<?php try { $db = sqlite_open("distributorlogin1.db"); //sqlite_query($db , "CREATE TABLE tbllogin (username CHAR(100), password CHAR(100), company CHAR(200), timestamp CHAR(200) salesimage BLOB); }catch (Exception $e){ echo 'Caught Exception ', $e->getMessage(), "\n"; } echo 'Created Database distributorlogin1.db.'; // close database connection sqlite_close($db); ?>
-
Oct 29, 2007, 05:43 #2
- Join Date
- May 2006
- Location
- Lancaster University, UK
- Posts
- 7,062
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Hi.
A blob field doesn't use a field length, (it's set to aboout 65kb). The timestamp should be set to an Int or TimeStamp field. Also, (and I'm not completely positive on this) you shouldn't use CHAR for long fields - use VARCHAR instead.
You say you can't get it to work - what's the error?Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
-
Oct 29, 2007, 05:55 #3
- Join Date
- Jan 2007
- Posts
- 296
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
there is no error the script works fine but the database when it has been created as no data in it its just a blank file. Cab you set the blob field to store higher quality pictures like say 1mb???
-
Oct 29, 2007, 06:19 #4
- Join Date
- May 2006
- Location
- Lancaster University, UK
- Posts
- 7,062
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Yes, by using "MediumBlob" and "LongBlob".
Have you tried inserting data into the database?
I recommend using MySQL instead of SQLite - it's much better at handling alot of data (and it's much more supported on forums such as sitepoint).Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
Bookmarks