FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Perform maths based on a number in a text file
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Perform maths based on a number in a text file [message #183768 is a reply to message #183747] Mon, 18 November 2013 16:38 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 11/18/2013 4:23 AM, drkirkby(at)gmail(dot)com wrote:
> I'm tyring to simplify the design of a web site which uses PHP, and hope someone can help me. Basically I want to store a number in a file on a web site, and display that number, or a variation of it, on a number of web pages. Let's say the parameter is "A", and is 10 ps. Three different web pages need to display this number, but in 3 different ways.
>
> 1) First page shows just A
> 2) Second page multiples A by 3
> 3) Third page multiples A by -2
>
> So if A was 10
>
> 1) Page 1 should show 10
> 2) Page 2 should show 30
> 3) Page 3 should show -20.
>
> If the value of A changes, I'd like to update the web site in one place, and not go around to every page updating them individually, as that will be error prone.
>
> Is there a way to put the value of A in a text file, and use the value in different parts of the site? If so how?
>
> Since there will actually be 15 or so parameters, A, B, C ..., is there a way I can put all 15 parameters in a file (perhaps one per line, or with white space between them), rather than have 15 different files?
>
> If you look at this web page which is for an economimcal / low cost vector network analyzer kit,
>
> http://www.vnacalibration.co.uk/support/85033/Rohde+Schwarz/
>
> you can see the numeric values in the form used by Rohde & Schwarz for their vector network analyzers, whereas in this page which is a bit longer, under the section "Standard Definitions",
>
> http://www.vnacalibration.co.uk/support/85033/HP/
>
> one has basicaly the same parameters, but expressed in a different way. Another make of vector network analyzer wants the parameters in a different way.
>
> Any thoughts?
>
> Dave
>

Sure. Look up the file functions - fopen, fread, fwrite, etc. But you
do have to watch out that another script is not accessing the file while
you are writing it. Additionally, when you do write the file, you will
need to write all values unless you're changing the last one.

Easier would be a database which solves these problems for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: array search part 2
Next Topic: What do you think about this book on API ?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 01:55:48 GMT 2024

Total time taken to generate the page: 0.04198 seconds