![]() |
[php] - howto update variable in external php file
i need some quick php help...
let's say i have a file called x.php with a few variables in it Code:
$a = "2"; Code:
include 'x.php'; thanks |
format c:
|
|
thanks for the great help...
|
If you are declaring constants such as "$a = "2";" then the only way to change it from another script would be to either redeclare it in y.php or re-write x.php using a file write.
There may be other options, but without a more in depth look at your complete script, it's difficult to form them. |
Thanks Robbie.
i'll look into file write. |
do you want to update the var in the file?
|
Quote:
|
Quote:
yes....... |
Quote:
then the only thing you can do is rewrite file easiest thing is every var on a line like 2 3 4 then $filename = "vars.txt"; $my_vars = file($filename); $my_vars[0] will be 2 if you have changed the vars just save the array. |
You need to open and read the file and then rewrite the contents. Something like this (has not been tested)...
PHP Code:
|
thanks a lot guys.
i think i'll go with grumpy's idea... |
All times are GMT -7. The time now is 04:57 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123