How do I import tables into MySQL from web page ...

From: Date: Wed, 10 Jul 2002 01:09:36 +0000
Subject: How do I import tables into MySQL from web page ...
Groups: php.general 
Request: Send a blank email to php-general+get-106635@lists.php.net to get a copy of this message
Hi, I am trying to import some tables from a dump file into a MySQL database from a php web page. What is the best way to do this without using backticks (fpassthru, system, exec or something else) and test for success or failure? I tried the following and while it works, my test for success or failure always produces a "Success" even when I change something to make it fail. I thought system() outputs the last line of the command on success and FALSE on failure. Any examples appreciated. <?php $status = system("mysql -umyuserid -pmypassword mydbname < /path/to/mydumpfile.txt"); if($status == 'FALSE'){ echo 'Failed'; } else { echo 'Success'; } ?>

« previous php.general (#106635) next »