 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
05-18-2009, 10:48 AM
|
#21 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Posts: 49
Thanks: 0
|
I think I'm going back to using my own custom method... I'm not too good at SQL programming and somehow SQLite hasn't got some admin panel or something...
So is there any concept which will overcome my problem? When later sessions overwrite all the existing values?
|
|
|
|
05-18-2009, 11:36 AM
|
#22 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Quote:
|
and somehow SQLite hasn't got some admin panel or something...
|
I believe it has a few, http://phpsqliteadmin.sourceforge.net/ being one of them.
Quote:
|
I'm not too good at SQL programming
|
Surely it would be far easier to learn basic SQL, its not that hard! much simpler than implementing a flatfile database.
Are interceding updates not going to be an issue?
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-18-2009, 11:40 AM
|
#23 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
I really wouldn't use my own custom method. I've tried to do projects where I've maintained my own framework, if I were maintaining my own data storage as well, I'd have collapsed and quite likely have died by now.
Don't, just don't  Not if you know what's good for you! Use something that's been around for a while, it's been tested throughout. The less work you give yourself in management, the better. I don't even manage my own framework any more.
Being young programmers though, we do like to think we can manage it all.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
05-18-2009, 01:12 PM
|
#24 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by Wildhoney
I really wouldn't use my own custom method. I've tried to do projects where I've maintained my own framework, if I were maintaining my own data storage as well, I'd have collapsed and quite likely have died by now.
Don't, just don't  Not if you know what's good for you! Use something that's been around for a while, it's been tested throughout. The less work you give yourself in management, the better. I don't even manage my own framework any more.
Being young programmers though, we do like to think we can manage it all.
|
Agreed. I think what it comes down to are 3 things.
1) reluctance to use a DB, hence the need to go flat file. Which now you have to come up with a whole way of accessing/modifying the file in your own custom way which is not a guarantee any success.
2) advanced programmers have already been there done that, so it's quite easy for them to see the positives of using a framework to avoid re-inventing the wheel.
3) curiosity. I personally need to re-invent the wheel so that I can have a better understanding of how things works before I start to fully engage in frameworks etc...plus it would also allow me to appreciate frameworks.
|
|
|
|
05-19-2009, 12:53 AM
|
#25 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
Quote:
Originally Posted by TheOnly92
I think I'm going back to using my own custom method... I'm not too good at SQL programming and somehow SQLite hasn't got some admin panel or something...
|
SQL is fairly easy to learn, the initial concepts take very little time. Making your own custom format will be harder, less efficient and far less reliable.
Quote:
Originally Posted by TheOnly92
So is there any concept which will overcome my problem? When later sessions overwrite all the existing values?
|
Your options are pretty much SQL, an existing text storage method (CSV, XML, ect) and a custom method made by you. SQL is the easiest.
Quote:
Originally Posted by Enfernikus
Sessions persist until the user leaves the page ( I believe ) or until you destroy them
|
Partially true. Sessions exist until the machine destroys them. This can be manually or automatically done (the same exact process is called). If Apache works like IIS (it should in this respect), there is a set time limit till the server deletes the session, the session will remain until that period of inactivity has passed unless a manual deletion is called. This is because the server can not really know if you have left the page, all it knows is when you access it.
Sessions are not designed to be shared or constantly modified. Every time the session gets modified the computer has to modify the text file it is being held in (the format is almost plain text). If you have a value that is being modified very often over a large period of time, don't use sessions.
|
|
|
|
05-19-2009, 05:51 AM
|
#26 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Posts: 49
Thanks: 0
|
Ok, it seems a lot have been asking me to really learn SQL well... Quite reluctant, to be honest, those "CREATE TABLE" thingy really did made my mind burst. I will try SQL again, if I bump into problems, I will be posting here hopefully you will help me.
But the fact is that some of my script's users might be using on their localhost, which means Windows, then I must really need to ask them to install the sqlite extension (which will be annoying because quite many users simply don't know how to read instructions)...
|
|
|
|
05-19-2009, 07:32 AM
|
#27 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Posts: 49
Thanks: 0
|
What I want to say is I really dislike SQLite, it keeps giving me undefined method eventhough it's documented in PHP's site.
Code:
Call to undefined method SQLiteDatabase::escapeString()
Can anyone also point out my mistake? I'm using PHP 5.2.9 under FastCGI
Code:
$DBHandle = new SQLiteDatabase($this->DBFile);
if (!$DBHandle) {
die("Could not access instance database");
}
$this->DBHandle = $DBHandle;
$this->DBHandle->query('CREATE TABLE instances (
id varchar(255),
Created int(11),
Name varchar(255),
Link varchar(255),
Status varchar(50),
Size varchar(255),
Speed varchar(255),
Received varchar(255),
Unique varchar(12)
);');
$query = "INSERT INTO instances (id, Created, Name, Link, Status, Size, Speed, Received, Unique) VALUES
('$id',".time().",'".$this->DBHandle->escapeString($filename)."','".$this->DBHandle->escapeString($link)."',".
"'$status','$size','$speed','$received','$unique')";
$this->DBHandle->query($query);
|
|
|
|
05-19-2009, 10:42 AM
|
#28 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Try:
sqlite_escape_string
instead, i don't think there is an OOP alternative.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-19-2009, 11:41 AM
|
#29 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Where did you see SQLiteDatabase::escapeString() documented? As sketch pointed out, you'll need to use the function sqlite_escape_string.
|
|
|
|
05-19-2009, 02:59 PM
|
#30 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Location: US
Posts: 76
Thanks: 0
|
Quote:
Originally Posted by TheOnly92
Ok, it seems a lot have been asking me to really learn SQL well... Quite reluctant, to be honest, those "CREATE TABLE" thingy really did made my mind burst. I will try SQL again, if I bump into problems, I will be posting here hopefully you will help me.
But the fact is that some of my script's users might be using on their localhost, which means Windows, then I must really need to ask them to install the sqlite extension (which will be annoying because quite many users simply don't know how to read instructions)...
|
Why Not use a WAMP setup?
(Windows, Apache, MySQL, PHP)
MySQL has phpmyadmin and your windows users can install WAMP, and they will be all set.
Using MySQL you don't need to worry about creating tables just selecting, inserting, deleting
|
|
|
|
05-19-2009, 03:09 PM
|
#31 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Quote:
|
Using MySQL you don't need to worry about creating tables just selecting, inserting, deleting
|
You dont need to either with sqlite (edit: once they are created that is), unless you use a memory based database:
PHP Code:
$db = new SQLiteDatabase(':memory:');
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-20-2009, 08:43 AM
|
#33 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
I believe SQLite3 is in PHP5.3.0, not sure though.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-20-2009, 09:08 AM
|
#34 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Posts: 49
Thanks: 0
|
Well, you have a list of SQLiteDatabase methods?
|
|
|
|
05-20-2009, 09:10 AM
|
#35 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
05-21-2009, 10:47 AM
|
#36 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Posts: 49
Thanks: 0
|
Thanks a lot, looking into my own problems now.
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|