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 #183804 is a reply to message #183800] Wed, 20 November 2013 12:02 Go to previous messageGo to previous message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma:
Junior Member
drkirkby(at)gmail(dot)com wrote:

> On Monday, 18 November 2013 13:19:50 UTC, The Natural Philosopher wrote:
>
>> I would strongly recommend using a database: setting that up is a bit of
>> a faff, but once set up it provides the sort of 'update by one screen,
>> read buy many others' sort of access that you need. And wont need any
>> file level parsing - you will get your numbers as an array from a Mysql
>> type query.
>>
>> You can even embed the mathematics in the query instead of doing it on
>> PHP, if you want.
>>
>> But all this assumes you are willing to knuckle down and learn basic
>> SQL, mysql administration, and how to set up web forms and the like.

>>
>> If you are as you sound, a relative newcomer, this is a few weeks work
>> :-(
>
> Hi,
> thank you for your thoughs. To be honest, I'm not over keen on using a
> database. I'm not a web designer, but an engineer trying to get data about
> his product on a web page. Maybe the constants will be updated in the
> future, but perhaps they never will. It is certainly not something I
> expect to do on a regular basis. The idea of spending 3 days working on
> this does not attract me.
>
> To answer the question asked by someone else about how the constants will
> get updated. It will be me doing it manually - no program will update
> them. Maybe file_get_contents will do what I want.
>
> Dave

Another possibility would be to add the values as variables in a file and
then include() that file in scripts where the value(s) need to be used.

For example:

variables.inc
<?php
$thisvar = 3;
$thatvar = 7;
?>

And then in any script that needs to know these values something like:

<?php
//.....
include 'variables.inc';
$new_thisvar = $thisvar * 3;
//.....
?>

Add other ingredients to taste :-)

--
Cheers
David Robley

Useless Invention: Self stick frying pan.
[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:40:28 GMT 2024

Total time taken to generate the page: 0.05249 seconds