homepage Welcome to WebmasterWorld Guest from 54.161.246.212
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP MySql dump not possible
Rhys

10+ Year Member



 
Msg#: 3060831 posted 10:26 pm on Aug 25, 2006 (gmt 0)

Have been struggling to wite a script to do a dump with php - It writes a dump file, but it is always empty (0kb)?

$link=mysql_connect ($host, $user) or die ;
mysql_select_db ($database) ;
$fish = (" mysqldump $database > $pathdump\\$filename ");
exec($fish);

Is it possible?

 

jezra

10+ Year Member



 
Msg#: 3060831 posted 10:43 pm on Aug 25, 2006 (gmt 0)

since you are calling mysqldump from the shell, you do not need to create a PHP connection to the database. The mysqldump command is probably not connecting to the database and is outputting nothing. You should try some thing like:
$command ="mysqldump --host=$host --user=$user_name --password=$password $database > $pathdump/$filename";
exec($command);

Rhys

10+ Year Member



 
Msg#: 3060831 posted 11:10 pm on Aug 25, 2006 (gmt 0)

Hey Jezra -

That code worked first shot - thank you very much.

:-)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved