473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP Server-based variables/flags

Hello!

I have been working on a php script. In the script, fast reading/writing is necessary to a variable on the server side. It is a one bit flag. Right now, I have been using a text file to write the value 0 or 1 to it, but it isn't very efficient. I was wondering if there is a better way to do this other than the text file or a database. I don't want to add the extra requirement of a database to my program.

Thanks a lot!
Aug 5 '07 #1
4 1396
jx2
228 100+
Hello!
It is a one bit flag. Right now, I have been using a text file to write the value 0 or 1 to it, but it isn't very efficient.
Thanks a lot!
you need to give as better idea on what you are trying to do

normally you can store variables in the SESSION which automaticly save registered variables for you
you can try to use mysql if you want to share it between a few users or serialize session

ps: text files are very efficient thats just a data and it depends how u handle it

all depends what you trying to achive

regards
jx2
Aug 5 '07 #2
Thank you for your reply

What I have done is created an AJAX-based application which sends off an int to the server. 0 queries the bit, 1 is set the bit to true, and 2 sets the bit to false. The bit is queried every 300 milliseconds by every client connected to the server. All of these clients need to have access to the same bit. So what I was wondering is if there is any way to do this other than through text files. Maybe there is something similar to a cookie on the server? I REALLY don't want to use a MySQL database, and it just seems like a waste to use a text file just for a 0 or 1.

Thanks again!
Aug 5 '07 #3
pbmods
5,821 Expert 4TB
Heya, tromboneman. Welcome to TSDN!

If your server isn't storing the data SOMEWHERE on the hard drive, where is it going to store it? There is no mystical bit bucket floating over Silicon Valley; that's just the smog :)

Of all your options, storing the value in a text file is actually the *most* efficient. It just also happens to be the least scalable.

You could store the value in a database (which gets saved into a file on the hard drive).

Or you could store the value in $_SESSION (which gets saved into... a file on the hard drive!).
Aug 5 '07 #4
Okay, thank you. I just assumed there would be a way to store temporary variables in memory. Thank you for your help!
Aug 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
4
by: rs | last post by:
how I the client tell the server that the socket is closed? or this there an even that informs the server that the clients socket is close? Oh, I am using vb.net 2003 Thanks
4
by: coosa | last post by:
Hi, I was installing SQL Server on my machine and during installation my PC freezed. It happens frequently on my machine. So i tried after restarting to install it again and since then i always...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.