Unix Technical Forum

SQL to CSV

This is a discussion on SQL to CSV within the MySQL forums, part of the Database Server Software category; --> I have a web form to collect data On submit I intend sending the data to my email address ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:35 AM
Garry Jones
 
Posts: n/a
Default SQL to CSV

I have a web form to collect data

On submit I intend sending the data to my email address and to a mysql
database.

Whats a simple way for me to get the mysql database to email me a csv file
from the database? On request. And every day at 08.00 say.

Garry Jones
Sweden





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:35 AM
Artur Baæ
 
Posts: n/a
Default Re: SQL to CSV


"Garry Jones" <garry.jones@morack.se> wrote in message
news:e1ej11$6gt$1@yggdrasil.glocalnet.net...
>I have a web form to collect data
>
> On submit I intend sending the data to my email address and to a mysql
> database.
>
> Whats a simple way for me to get the mysql database to email me a csv file
> from the database? On request. And every day at 08.00 say.
>
> Garry Jones
> Sweden
>

Use additional application on server, for example with cron scheduling
Simplest way is writing such app in Python or Perl + any Cron on
Linux/BSD/Unix

MySQL5.1beta has got Event Schduler but MySQL doesn't have smtpclient
functions.

Artur


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 07:35 AM
strawberry
 
Posts: n/a
Default Re: SQL to CSV

What OS are you using?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 07:35 AM
Bill Karwin
 
Posts: n/a
Default Re: SQL to CSV

Artur Baæ wrote:
> MySQL5.1beta has got Event Schduler but MySQL doesn't have smtpclient
> functions.


Heh! Zawinski's law has not (yet) affected MySQL!
http://en.wikipedia.org/wiki/Zawinski%27s_Law

I agree -- write a simple script on the server, run by cron, to dump
data into a CSV file and then email that file. One can run a SQL query
"SELECT ... INTO OUTFILE" to do this.

See paragraph on SELECT ... INTO OUTFILE in the following page:
http://dev.mysql.com/doc/refman/5.0/en/select.html

Regards,
Bill K.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-28-2008, 07:35 AM
Garry Jones
 
Posts: n/a
Default Re: SQL to CSV

> Artur Baæ" <nospam_artur@ebasoft.com.pl> skrev i meddelandet
> news:e1el8l$32b$1@news.task.gda.pl...


>> Whats a simple way for me to get the mysql database to email me a csv
>> file from the database?


Thanks for the advice yesterday. I can now retrieve the data on demand but
it is still leaving me short of what I want to do.

When the user submits the form I would like to immediately send a copy of
the data entered to the users own email adress and my email adress (as
backup incase there is an MySQL problem.

Some way of doing a double form action so the data is sent both to mysql and
formmail would be ideal.

Any ideas?

Garry Jones
Sweden



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-28-2008, 07:35 AM
Garry Jones
 
Posts: n/a
Default Re: SQL to CSV

> What OS are you using?

Windows XP.

Garry


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-28-2008, 07:35 AM
Bill Karwin
 
Posts: n/a
Default Re: SQL to CSV

Garry Jones wrote:
> When the user submits the form I would like to immediately send a copy of
> the data entered to the users own email adress and my email adress (as
> backup incase there is an MySQL problem.


So you must have a script somewhere that is handling the form and
inserting data into the MySQL database. I infer from your other
postings that you're using PHP.

There are functions that can be used in PHP to send email.

Here's a tutorial on how to do use them:
http://www.phpfreaks.com/tutorials/130/0.php

Your PHP script that inserts data to MySQL has access to the form
parameters, of course. Use the same values to populate the mail message
as a string, and then send it with the PHP mail class.

Regards,
Bill K.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com