Jump to content

Help with a simple php script to read/write something specific to a cvs file


rookie4002

Recommended Posts

Hi, I'm a php newbie here and would like if someone can help me write the following

 

First I have an excel file composed of 2 columns, the first one different coupon codes  (letters and numbers) and the second one has the text either "sold" or "unsold". I convert this file to csv and this is upon what the script should act.

 

The php script should basically do:

 

1) scan this file starting from the top row and check to see whether that row is sold or unsold (by checking the second column corresponding to that row).

 

2) If it's unsold then it should save the first column entry (corresponding to the coupon) into a variable (we can call it $coupon), replace unsold by sold in the second column, save the new csv and that's it.

 

3) If it's sold, then it should move onto the second row and start the checking process again (step 1 but from row 2)

 

I think it could be done in like 10 lines of code but I've been looking around and couldn't exactly figure all the details, I tried some functions but don't have all the syntax nailed. If anybody can help me with this I'd GREATLY appreciate it.

 

Thanks a ton

 

Inaki

 

Link to comment
Share on other sites

Lol, I tried for about 2 - 3 hours, but since I don't know anything about php, I had to look up functions, syntax, etc, then upload code to a server everytime I wanted to test something, all in all, it'd take me forever without help!

 

And it doesn't help that I have to take the prelim for my phd after christmas, I should be studying for that. BUT, I need the script to run an ebay store!

 

By the way, the code has to run in a free x10hosting server, but I'm guessing it should have all the php functions required to do this simple thing.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.