Hii this is pradeep here . i am a newbie to PHP .can u help me out.
i hve a file called con.conf(config uration file) tht contains
name:pradeep
place:bangalore
i need to read this file and display the contents in form type in browser . and then gve a submit button so as to edit and update the file .
can u gve me a code for this process.
email:[ REMOVED ]
59 4174 mwasif 802
Recognized Expert Contributor
Checkout file() function of PHP.
Do not post your email address and choose a descriptive title. Posting Guidelines
Checkout file() function of PHP.
Do not post your email address and choose a descriptive title. Posting Guidelines
but plzz gve me code for tht program if u can.i read tht file() but cld not do it. plzz can u help me wit code..i wll be great ful to u
kovik 1,044
Recognized Expert Top Contributor
but plzz gve me code for tht program if u can.i read tht file() but cld not do it. plzz can u help me wit code..i wll be great ful to u
Unless you have money, your "great"-fulness isn't worth much (at least not to me :-D).
What you want to do is something that a database could do easily. If you really want to do it with a file, then go back to the documentation for the file() function and read the documentation for ALL of the file functions (fread(), fwrite(), fopen(), etc.) and make the code.
It's not hard to decipher. I only help those who help themselves. Show some effort, and you'll get some assistance.
Unless you have money, your "great"-fulness isn't worth much (at least not to me :-D).
What you want to do is something that a database could do easily. If you really want to do it with a file, then go back to the documentation for the file() function and read the documentation for ALL of the file functions (fread(), fwrite(), fopen(), etc.) and make the code.
It's not hard to decipher. I only help those who help themselves. Show some effort, and you'll get some assistance.
OK COOL..I KNOW ALL THE FILE OPERATIONS..BUT THE FILE CONTAINS ENTIES LKE
NAME:PRADEEP
PLACE:BLORE
THE NAME AND PLACE SHLD BE A FIXED FIELD IN THE FORM AND THE REST MUST VARY..PLZZ HELP ME HOW TO FETCH THE VARIABLES FROM FILE....OR ELSE GVE ME SOME SUGGESTIONS AS TO HOW TO GO ON WIT IT.
nathj 938
Recognized Expert Contributor
OK COOL..I KNOW ALL THE FILE OPERATIONS..BUT THE FILE CONTAINS ENTIES LKE
NAME:PRADEEP
PLACE:BLORE
THE NAME AND PLACE SHLD BE A FIXED FIELD IN THE FORM AND THE REST MUST VARY..PLZZ HELP ME HOW TO FETCH THE VARIABLES FROM FILE....OR ELSE GVE ME SOME SUGGESTIONS AS TO HOW TO GO ON WIT IT.
1) What have you got written so far? Posting code you are stuck with will get you better help.
2) Have you read about the explode() function
The explode() function will enable you to retreive the contents of your file into an array.
I must say that the best way to do this would be with a database. It's not difficult, read some tutroials on W3Schools and you'll be up and running in now time.
Cheers
nathj
1) What have you got written so far? Posting code you are stuck with will get you better help.
2) Have you read about the explode() function
The explode() function will enable you to retreive the contents of your file into an array.
I must say that the best way to do this would be with a database. It's not difficult, read some tutroials on W3Schools and you'll be up and running in now time.
Cheers
nathj
FOR THIS I AM NOT SUPOSED TO USE A DB THTS THE PROB..CAN U GVE ME CODE FOR THIS ONE ..IF U CAN
nathj 938
Recognized Expert Contributor
FOR THIS I AM NOT SUPOSED TO USE A DB THTS THE PROB..CAN U GVE ME CODE FOR THIS ONE ..IF U CAN
Okay, so you can't use a database, that shouldn't be a problem.
Have you tried using the explode() function I pointed out?
Try that and let me know how you get on? When you are playing around with it you may also find print_r(arrayna me) useful.
The explode function takes a string and converts it to an array, you can then print the array (print_r) to see what you've got and how you can use it best.
Have a go and post the code you get stuck on. Having a go is the best way to learn.
Okay, so you can't use a database, that shouldn't be a problem.
Have you tried using the explode() function I pointed out?
Try that and let me know how you get on? When you are playing around with it you may also find print_r(arrayna me) useful.
The explode function takes a string and converts it to an array, you can then print the array (print_r) to see what you've got and how you can use it best.
Have a go and post the code you get stuck on. Having a go is the best way to learn.
see i wll tell how i wnt to move abt
1st open the file in read mode
then take each line in a string using a for loop or so
then using explode searching for the : i wll split name:pradeep into 2 and then assign it some 2 variables;
and then print them in the form .
then use $_post method to read from the form and then write them to the file..
do u hve any suggstions on this
Okay, so you can't use a database, that shouldn't be a problem.
Have you tried using the explode() function I pointed out?
Try that and let me know how you get on? When you are playing around with it you may also find print_r(arrayna me) useful.
The explode function takes a string and converts it to an array, you can then print the array (print_r) to see what you've got and how you can use it best.
Have a go and post the code you get stuck on. Having a go is the best way to learn.
after reading from the form say $_post['name']
how to write back to file in same format as
name:pradeep
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: JDJones |
last post by:
I'm trying to write a script that will read from a text list of songs
that I burned onto my CD (Albums011.txt), then write to the database
text the new text made ready for inserting into a database.
The entries from the Albums011.txt look like this:
Wayne Newton - Wild Cool & Swingin' - 03 - But Not For Me.mp3
Wayne Newton - Wild Cool & Swingin' - 04 - Wives And Lovers.mp3 etc.
and I want to manipulate it them to look in the...
|
by: Amy G |
last post by:
I am looking to make this code a little "nicer"... any suggestions???
I want to do a "read+" where I would be able to first read the contents of
the file... then either close the file out or write to the file without
appending. I want to overwrite the content.
vacation_message = "blah blah blah"
f_vm=open("/home/%s/.vacation.msg" %userid, 'r')
lines=f_vm.readlines()
f_vm.close()
|
by: Joan Bos |
last post by:
Hi,
Is there somewhere on the Internet a description of what a .NET
application config file should contain?
For our application, I have to write passwords encrypted in a config
file. The Enterprise Library does have an encryption method, but that
method doesn't just return a value - no - it wants to write the value
immediately to a config file. Except, it always gives an error, because
no config file contents are ever good enough for...
|
by: Jason Heyes |
last post by:
Does this function need to call eof after the while-loop to be correct?
bool read_file(std::string name, std::string &s)
{
std::ifstream in(name.c_str());
if (!in.is_open())
return false;
char c;
std::string str;
|
by: cnu |
last post by:
My program generates a log file for every event that happens in the program.
So, I open the file and keep it open till the end. This is how I open the
file for writing:
<CODE>
public CLogHandler()
{
this.m_fsLog = new FileStream(strTodaysLogFile, System.IO.FileMode.Append,
System.IO.FileAccess.Write, System.IO.FileShare.Read);
this.m_swLog = new StreamWriter(this.m_fsLog);
| |
by: ESPN Lover |
last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one
way preferred over the other and why? Thanks.
using System;
using System.IO;
class Test
{
public static void Main()
|
by: Tibby |
last post by:
I need to read/write not only text files, but binary as well. It seems like on binary files, it doesn't right the last 10% of the file.
--
Thanks
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 11/10/2003
|
by: kepioo |
last post by:
I currently have an xml input file containing lots of data. My objectiv
is to write a script that reports in another xml file only the data I
am interested in. Doing this is really easy using SAX.
The input file is continuously updated. However, the other xml file
should be updated only on request.
Everytime we run the script, we track the new elements in the input
file and report them in the output file.
|
by: =?Utf-8?B?ZGF2aWQ=?= |
last post by:
I try to follow Steve's paper to build a database, and store a small text
file into SQL Server database and retrieve it later. Only difference between
my table and Steve's table is that I use NTEXT datatype for the file instead
of using IMAGE datatype. I can not use SqlDataReader to read the data. I need
your help, Thanks.
-David
(1) I have a table TestFile for testing:
ID int
FileName navrchar(255)
|
by: Kevin Ar18 |
last post by:
I posted this on the forum, but nobody seems to know the solution: http://python-forum.org/py/viewtopic.php?t=5230
I have a zip file that is several GB in size, and one of the files inside of it is several GB in size. When it comes time to read the 5+GB file from inside the zip file, it fails with the following error:
File "...\zipfile.py", line 491, in read bytes = self.fp.read(zinfo.compress_size)
OverflowError: long it too large to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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...
|
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,...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |