473,768 Members | 6,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change 1 line in a php file

170 New Member
I have a php file which looks like this:

<?php
$subjectshort=' vetcm';
$comparray=arra y('c1','c2','e1 ');
?>

I need to change the $comparray line so it now looks like this:

$comparray=arra y('c1','c2','e1 ','e2');

How can I do this (I would appreciate actual code if possible).

Thankyou.
Nov 27 '07 #1
4 1522
MarkoKlacar
296 Recognized Expert Contributor
I have a php file which looks like this:

<?php
$subjectshort=' vetcm';
$comparray=arra y('c1','c2','e1 ');
?>

I need to change the $comparray line so it now looks like this:

$comparray=arra y('c1','c2','e1 ','e2');

How can I do this (I would appreciate actual code if possible).

Thankyou.
Hi,

you mean you want to add values to the array dynamically?
Nov 27 '07 #2
beary
170 New Member
Hi,

you mean you want to add values to the array dynamically?
Thanks for your reply.

Um, well, yes I need this to happen via a script. The 'e1','e2' etc represent competencies, and when a user adds a competency, it needs to update this file. This file contains all the short abbreviations, and pretty much every other file in the system accesses this file to work.

Now obviously I myself can easily and quickly change this file manually, but the system is designed to be used by anyone without accessing the files directly on the server. Thus the need for the script to do it automatically.
Nov 27 '07 #3
gregerly
192 Recognized Expert New Member
Thanks for your reply.

Um, well, yes I need this to happen via a script. The 'e1','e2' etc represent competencies, and when a user adds a competency, it needs to update this file. This file contains all the short abbreviations, and pretty much every other file in the system accesses this file to work.

Now obviously I myself can easily and quickly change this file manually, but the system is designed to be used by anyone without accessing the files directly on the server. Thus the need for the script to do it automatically.
Personally, I'm thinking this is something that would be well suited for a database. Store the competencies in the DB, and pull them into your file dynamically, rather than actually writing to the file. Just a personal thing, you can probably get it to work either way, but the database option would be alot easier.

Greg
Nov 28 '07 #4
beary
170 New Member
Personally, I'm thinking this is something that would be well suited for a database. Store the competencies in the DB, and pull them into your file dynamically, rather than actually writing to the file. Just a personal thing, you can probably get it to work either way, but the database option would be alot easier.

Greg
Gregerly, Thanks for your tip. You're probably right, it probably is suited for a db. But it's a 1 off thing, and I'm still wondering whether anybody out there can tell me the required code. I didn't think it would be too complicated. Perhaps I'm wrong...
Nov 29 '07 #5

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

Similar topics

3
3390
by: Mike Barnard | last post by:
Hi all, newbie here. Odd sounding subject but I can't describe it any better. I'm trying to teach myself a little about CSS. In a test site (not published) I am trying to use CSS to make navigation buttons. I'm using the tutorial I found at this site as a basis for it. http://www.mako4css.com/TFonts.htm
2
2307
by: Daniel Lidström | last post by:
Hi, I would like to know the cleanest way to change the serialization of my Line class from: <Line staStart="2327.02" length="10.00000003390744"> <End>549016.570965 57945.741122</End> <Start>549019.590988 57955.274194</Start> </Line>
3
8481
by: Don Pasquale | last post by:
The following function intends to delete "numberoflines" lines from a text file, named "s" (string pointer) and pointed to by file pointer "fp", starting from line "line". Now, the function works an inteded, but I think that this is purely coincidential. I'm using a temp file to copy the contents of the text file, and then, copy the last lines that i want to keep, on top of those i want to delete.I fwrite an EOF character after the...
13
4968
by: sonald | last post by:
Hi, Can anybody tell me how to change the text delimiter in FastCSV Parser ? By default the text delimiter is double quotes(") I want to change it to anything else... say a pipe (|).. can anyone please tell me how do i go about it?
3
7942
by: W C Hull | last post by:
We have a request from Auditing to modify the password an a local workstation administrative account every 90 days. We are developing two programs - a VB6 GUI program that will allow the administrative support person to enter a new password into an App and have that encrypted password saved in a text file. The second part is a VB6 program that only is a command line program that will open the password text file, read the encrypted...
1
5750
by: yashgt | last post by:
Hi, We have an application that has been deployed into a virtual folder along with ascx, aspx and the code-behind files. It runs smoothly as long as we don't change any code-behind file. If we change a file, we expect ASP .NET to recompile the website when a user next accesses it. However, on next access the user gets the following error: Description: An error occurred during the compilation of a resource required to service this...
1
1557
by: st12iker | last post by:
I have a datafile with the following format from which I need to extract parts of the text and copy to a seperate file : Header (line 1) --------------------------- (line 2starts) Content - Content Content - Content Content - Content
1
3099
by: J. J. Ramsey | last post by:
In Perl, there is a module called "Tie::File". What it does is tie a list to each line of a file. Change the list, and the file is automatically changed, and on top of this, only the bits of the file that need to be changed are written to disk. At least, that's the general idea. I was wondering if something roughly similar could be done in Python, or at the very least, if I can avoid doing what amounts to reading the whole file into...
7
3211
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
I want to change the font color and weight at a specific position in the text. I am not sure where or what I need to do. It will be at position 155/156 from the left on each line. Here is the code I need to put it into. using System; using System.Drawing; using System.IO;
3
3179
by: Sevla | last post by:
hello, im having a problem to change a particular word in a line, can´t find where is my mistake also i would like to know how to make this program check automatically if a particular word exists on the line you got to you exchange it or not i didnt find the right condition to do it
0
10175
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10017
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9961
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8840
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5283
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3932
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.