I know about mysql . data can be stored in tables and received through queries.
But there has to be other ways/techniques server side information is stored . JavaScript tricks or something.
Just give me lil hint if you don't want to give a detailed answer.
btw I am talking about saving server side , not cookies or temporary variables.
Reason : making a website that takes user input , stores and displays later in different php pages.. So I want the input to be stored in some variable and then displayed
The only way I can think of is using database , but thats something I want to avoid. Its a small website and I am terrible programmer.
Also another answer I got for this question was that its all database only . SO is all the information(email,google's index) stored on the internets is in databases ?
ta
Lastly how is this site doing it ? its just 2 variables...
How is datat stored and retrieved on the server side?
Moderator: General Moderators
Re: How is datat stored and retrieved on the server side?
you can store in flatfiles - but not recommended unless it is a true write-once-read-many need,,
otherwise you would have to deal with locking and simultaneous writes, partial reads etc..
check the php manual for reading and writing files (fopen, fwrite)
otherwise you would have to deal with locking and simultaneous writes, partial reads etc..
check the php manual for reading and writing files (fopen, fwrite)
Re: How is datat stored and retrieved on the server side?
Code: Select all
session_start();
$_SESSION['foo'] = 'bar';
Re: How is datat stored and retrieved on the server side?
Thanks for the tip . I found this link: http://www.xentrik.net/php/flatfile.php . Which is absolutely perfect for my needs!you can store in flatfiles
But I do not understand the problem the write-once-read many problem. Could you elaborate on that ? Here is the write-into-file code
What exactly is the problem here please ?<?php
$name = "string";
$fp = fopen("data.txt","a");
fwrite($fp, $name\n");
fclose($fp);
?>
would it be a problem if data.txt is written into say 50 times a day ?
Re: How is datat stored and retrieved on the server side?
I think what Stoker means is that if you write to the file a lot, there is the chance that the file could be written to twice at the same time...which would screw it up.
In order to write to it properly, you'd have to lock the file so no one else can access it while it's being written to...but then obviously other users will have to wait.
Also, flat files are harder to modify, and retrieve the particular parts you want. As well as this, databases can be a lot quicker with indexes, since you only select the data you require.
Why don't you want to use a database?
In order to write to it properly, you'd have to lock the file so no one else can access it while it's being written to...but then obviously other users will have to wait.
Also, flat files are harder to modify, and retrieve the particular parts you want. As well as this, databases can be a lot quicker with indexes, since you only select the data you require.
Why don't you want to use a database?
Re: How is datat stored and retrieved on the server side?
1. small small website that may never take off. And I guess the flatfile would be open only for a few milliseconds for every write. I can take that chanceWhy don't you want to use a database?
2. I am terrible programmer
3. free account on 110mb don't let any database
besides this solution fits my needs perfectly
Re: How is datat stored and retrieved on the server side?
There are plenty of free hosts that offer databases.
It will be better in the long run imo...but it's your choice.
It will be better in the long run imo...but it's your choice.