Page 1 of 1
Can u write this simple script 4 me, pleeeease
Posted: Thu May 15, 2003 7:39 pm
by undo
first, I am not a PHP programmer at all. I am a flash designer and I want two PHP scripts that enable me to read from and write to a text file stored at server side. Data should be stored in array form so I can read and write using an index.
first script: write.php:
Inputs:
1) $FileName: the url of the text file where data is stored.
2) $Index: where data should be stored.
3) $Value: the value of the element to be stored.
Outputs:
1) $Error: if the specified element can't be stored this should return one otherwise zero.
2) $Length: number of elements in the array.
second script: read.php
Inputs:
1) $FileName: the url of the text file where data is stored
2) $Index: the index of the element to be read.
Outputs:
1) $Value: the value of the requested element.
2) $Error: if element can't be read this should return one otherwise zero.
3) $Length: number of elements in the array.
I know some of u won't like to write this kind of ready-to-use code. But, believe me I need it urgently.
Posted: Thu May 15, 2003 7:51 pm
by McGruff
See php.net for the manual - recommend the dowloadable version with user comments.
To read/write to file, remember that you need to create a file pointer first.
Posted: Thu May 15, 2003 11:16 pm
by undo
thank you first 4 ur advice.
But I don't even understand the PHP syntax. I want a ready-to-use code. I had a similar script. I understood its main idea but I couldn't run it because of syntax problems I think.
is there any body wanna to write these scripts??
Posted: Thu May 15, 2003 11:29 pm
by m3mn0n
check out the link in my sig
people will do it there...
Posted: Thu May 15, 2003 11:31 pm
by m3mn0n
btw if you ever do want to learn:
http://www.php.net/manual/en
If you start from the top of the Manual and work your way down and around, you should do well with practice. It isn't very hard to understand, it just takes some patience. Also check out sites like
http://www.evilwalrus.com and
http://www.phpbuilder.com .
Posted: Thu May 15, 2003 11:37 pm
by undo
Thanx a lot sami.
I will consider learning PHP because my current problem is because I can't write a server-side application. I am only a desktop programmer.
by the way, I had known that I can use visual basic or C++ to make CGI scripts which makes it easier 4 me to write CGI scripts than PHP. what's the difference between CGI and PHP? and what do you recommend 4 me? learning a completely new programming language like PHP? or take use of my knowledge and learn CGI???
Posted: Thu May 15, 2003 11:52 pm
by m3mn0n
I'd go for PHP first.
PHP really is easy to learn. If you can do HTML you can code PHP.

CGI is slightly more powerful is some ways, but PHP does what it was built to do best, and that's to be a web server side language.
I can't really speak on this matter great because i'm ignorant in the ways of CGI. You could say i know as much about CGI as you do PHP. =P
Here are some Google searches though:
PHP vs CGI &
Reasons to code in php
Also, you should have a read at these to get you started:

Click To Buy it @ Amazon
&

Click To Buy it @ Amazon
It's the
only two books you need.

Posted: Fri May 16, 2003 12:00 am
by undo
thanx alot, Actually I c that Php pages are much wider in use than other languages like ASP or cgi. I think I am going to learn PHP.
I thought scriptlance's programmers are volunteers. I didn't set a budget for anything at all. the whole work is for personal use
can anybody help me writing these scripts??
Posted: Fri May 16, 2003 12:07 am
by m3mn0n
there is online tutorials that walk you through these types of things for the first time.
Check out
this google search.
Posted: Fri May 16, 2003 3:24 am
by volka
first of all CGI is not a language, it's a specification (see:
http://hoohoo.ncsa.uiuc.edu/cgi/interface.html)
php can do it, as can perl, C ..hey, even a dos-batch might do the job
now you should read
viewtopic.php?t=511 to see how parameters are passed to php. Which version are you going to use (if) ?
I suggest reading the following manual pages
http://php.net/isfile ,
http://php.net/fopen ,
http://php.net/flock
http://php.net/file ,
http://php.net/fread ,
http://php.net/file_get_contents ,
http://php.net/include
http://php.net/unserialize
http://php.net/isset
http://php.net/count ,
http://php.net/strlen
http://php.net/echo
http://php.net/serialize
http://php.net/fputs
don't let the amount of pages overwhelm you, it's not that difficult and I think they are in order of appearance (in your script). There are many examples and user contributed notes that will explain each function.
hmm
Posted: Fri May 16, 2003 6:43 am
by irealms
if you know C then php is similar in it's operation, also if you want scripts i'd try
http://www.hotscripts.com, they seem to have everything.
Posted: Fri May 16, 2003 7:19 pm
by undo
thanx voka and irealms
this forums are really very useful...
Posted: Fri May 16, 2003 7:58 pm
by phice
Undo: That's why the forum's here.
