Can u write this simple script 4 me, pleeeease

Looking to hire a PHP developer for a paid position? Looking for a paid PHP job? Want to post your resume? Let the job hunt begin...

Moderator: General Moderators

Post Reply
undo
Forum Newbie
Posts: 11
Joined: Thu May 15, 2003 8:42 am

Can u write this simple script 4 me, pleeeease

Post 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.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post 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.
undo
Forum Newbie
Posts: 11
Joined: Thu May 15, 2003 8:42 am

Post 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??
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

check out the link in my sig

people will do it there...
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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 .
undo
Forum Newbie
Posts: 11
Joined: Thu May 15, 2003 8:42 am

Post 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???
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

I'd go for PHP first.

PHP really is easy to learn. If you can do HTML you can code PHP. :wink: 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:

Image
Click To Buy it @ Amazon


&

Image
Click To Buy it @ Amazon



It's the only two books you need. :wink:
undo
Forum Newbie
Posts: 11
Joined: Thu May 15, 2003 8:42 am

Post 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 :cry: :cry: :cry: :cry:

can anybody help me writing these scripts??
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

there is online tutorials that walk you through these types of things for the first time.

Check out this google search.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
User avatar
irealms
Forum Contributor
Posts: 215
Joined: Mon Apr 28, 2003 7:10 am
Location: Leeds

hmm

Post 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.
undo
Forum Newbie
Posts: 11
Joined: Thu May 15, 2003 8:42 am

Post by undo »

thanx voka and irealms
this forums are really very useful...
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Undo: That's why the forum's here. ;)
Image Image
Post Reply