View Single Post
  #1 (permalink)  
Old 01-22-04, 09:31 PM
gulfan gulfan is offline
New Member
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Importing to a mysql database via php

I’m having some problems moving a mysql database from one server to another. I’ve managed to export the database and ftp it to the server. I don’t have SSH access on the server so I’m unable to do a normal import like this:

mysql -uUSERNAME -p newdbname < /path/to/dump.sql

So I’m trying to do it using a php script but I’m not having much luck with it.

PHP Code:

<?php


$dbh 
mysql_connect('localhost''viforum_viforum''PASSWORD') or die(mysql_error() . " :: mysql_connect error");
$sdb mysql_select_db('viforum_viforum'$dbh);

mysql_query(file_get_contents('forumbackup-01-22-2004.sql'));

?>
The script is in the same directory as forumbackup-01-22-2004.sql and when executed it doesn’t return any errors. I’m not sure what I’m doing wrong, or if what I want to accomplish is even possible.
Reply With Quote