Hi Tedd,

If you don't have server access, then long story short, you can't use SELECT 
... INTO OUTFILE.  It's a server side operation -- from 
http://dev.mysql.com/doc/refman/5.1/en/select.html, "the file is created on the 
server host."  Plus from reading the other posts, you don't have permission to 
do it anyway.

Is php running on a unix server?  As someone else mentioned, you could at least 
try using the backtick operator to execute mysqldump on the command line:

$hostname = 'mysqlHostname';  // maybe not needed if it's on locahost via socket
$username = 'mysqlusername';
$password = 'your-password';
$db = 'theDbName';
$pathToFTPHome = '/home/accountusername';
$output = `mysqldump -h{$hostname} -u{$username} -p{$password} {$db} | gzip > 
{$pathToFTPHome}/dbdump.sql.gz`;

Then you can check via ftp if the mysqldump was successful after running the 
script.

You could also try it like this:
echo `mysqldump -h{$hostname} -u{$username} -p{$password} {$db}`;

Then it would dump the backup to the browser and you could save or copy/paste 
from your browser (if the database is small enough for that to work).

If those options don't work, then just do your select statements in php to get 
the data you want, iterate through each row, and output the data.  fputcvs is 
handy if you want to write the data as a csv file: http://php.net/fputcsv

Most shared hosting providers let you do backups through a control panel 
interface or do it automatically for you every night.  Might want to double 
check that it's not already being done.


_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to