batskeets: (finger)
[personal profile] batskeets
So, one of my clients wants a script that will dump the contents of his customer database into a comma-delineated text file, so he can import it into Excel and use that to manage his postal mailings.

Thing is, I've been mucking around with fopen/fwrite/etc. in PHP since yesterday, and I can't even get it to open the text file! I'm using the full path of the file, and I think the permissions on the text file are correct, so I'm not sure where to go from here. Any ideas on what the issue might be? PAPA TASUKETE ;_;

Of course, if I were smart, I'd just scrap this junk and do it as a CGI script in Perl, but connecting to an SQL database in Perl seems equally hairy. Argh!

---------

In other news, all the grades for my Most Important Classes (i.e. the ones I needed for graduation) have come in. In spite of any subconscious attempts at self-sabotage that may have occurred over the past couple of weeks, my grades are fine, and I am done! Wheeee! I still don't have a nihongo grade, but eh, whatever, I took it pass/no pass.

I am guessing mySQL?

Date: 2003-12-15 11:09 pm (UTC)
From: (Anonymous)
A easy to use program that will make it a snap is http://www.mysqlfront.de/ or if you want to do it quick by hand. Use the mysqldump command or select * into outfile '/home/www/contacts.txt' from tableofpeopleiwanttospam;

This is thedanceman btw.. just to lazy to login

Date: 2003-12-15 11:09 pm (UTC)
From: [identity profile] addwag.livejournal.com
yeah for good grades! Im still waiting for mine-- wtf.

Re: I am guessing mySQL?

Date: 2003-12-15 11:13 pm (UTC)
From: [identity profile] skeets.livejournal.com
Yeah, I would just do it by hand, but this guy is hoping that I can set up something simple where he can just go to a web page and click on a button when he wants to dump the current DB info into a text file. (he'd be doing this semi-regularly, after I'm no longer working for him) His server space is also run by a third party, so I probably can't install anything, either.

Date: 2003-12-15 11:15 pm (UTC)
From: [identity profile] skeets.livejournal.com
Yeah, I didn't get one of them until today, and it was the class that I was most worried about, grade-wise. All weekend, I felt like I was going to flip out kill whole town! ::rotfl::

Re: I am guessing mySQL?

Date: 2003-12-15 11:24 pm (UTC)
From: [identity profile] thedanceman.livejournal.com
http://www.phpmyadmin.net/phpMyAdmin/

In that case either use the code on this program or upload the php directly..It should be easy..and you should be able to install it. Then anytime they want, they can login and download a new file.
I am linking you to the demo, click export.

This tool rocks and I use to use it on sites.

Date: 2003-12-15 11:27 pm (UTC)
From: [identity profile] xplo.livejournal.com
Wow. You.. you're doublegeeky now. :o

I'm sad, and yet, proud. ;_;

Date: 2003-12-16 12:05 am (UTC)
From: [identity profile] starkodama.livejournal.com
I'm so mega proud of you for graduating! (Not like it was ever in doubt or anything! :D)

Date: 2003-12-16 12:26 am (UTC)
From: [identity profile] skeets.livejournal.com
(Not like it was ever in doubt or anything! :D)

Man, there were a few times where it totally was in doubt! Or maybe it's just me. ^^;

But still, thaaaaank you!! :D

Date: 2003-12-16 01:55 am (UTC)
From: [identity profile] arabella-jin.livejournal.com
Just you!! And congrats! Wehey!!!
I am sorry but all this computer jargon make less sense to me than a Sanskrit script...BTW, I don't know any Sanskrit..

Date: 2003-12-16 03:07 am (UTC)
From: [identity profile] niro.livejournal.com
*Cough*

That's a terrible script and I make no guarantees that it even works at all as I haven't tested it, but it does show how to connect to the db with perl.

Hmm, actually, this would probably be better (and is probably about what you're trying to do with php now), since it doesn't run the risk of eating all the server's memory if the dataset gets large, just disk space.

You could probably pull the first technique with straight php too. I don't know php worth a damn, so I can't give you code for that, but just set the content-type and dump the data straight out and let php handle it all, don't write it to a file at all.

Date: 2003-12-16 08:23 am (UTC)
From: [identity profile] muerte.livejournal.com
Can you get fopen to open a file to read in? What error do you get?

Date: 2003-12-16 08:24 am (UTC)
From: [identity profile] rantar.livejournal.com
If you still need any help I was planning on stopping by this afternoon and thanks to my new job I've gotten a slowly growing knowledge of database management and mysql in particular...

March 2017

S M T W T F S
   1234
567891011
1213 1415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 25th, 2026 01:38 am
Powered by Dreamwidth Studios