how to upload mysql database to my server space (hostgator,blue host) in programming method.any one can help me to do this.
Thanks in Advance
Sep 22 '10
12 2142 code green 1,726
Recognized Expert Top Contributor
Please supply the code you are trying
running test.php to execute a sql file
and the errors being returned that report an incorrect path
the path is not given correctly
- <?php
-
require_once('library/config.php');
-
-
$dbHost = 'localhost';
-
$dbUser = 'username';
-
$dbPass = 'password';
-
$dbName = 'dbname';
-
-
$today=date('Y/m/d');
-
-
$table=array('m_couponbook','m_discount','m_grade','m_kart','m_member','m_nonmember','m_publicholiday','m_rate','m_staff','t_billing','t_billingpenalty','t_cancelbilling','t_couponissue','t_duplicateaccesscard','t_groupbilling','t_groupbooking','t_memberattendance','t_memberpayment','t_raceallocation','t_raceevent','t_raceparticipation','t_performance','t_sponsorshipregistration','t_staffattendance');
-
$count=count($table);
-
for($i=0;$i<$count;$i++)
-
{
-
-
$backupFile = "backup/$table[$i].sql";
-
$query = "SELECT * INTO OUTFILE '$backupFile' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' FROM `$table[$i]`";
-
$result = dbQuery($query);
-
-
}
-
-
/*$backupFile = $dbName . date("Y-m-d-H-i-s") .'.gz';;
-
echo $command = "mysqldump --opt -h $dbHost -u $dbUser -p $dbPass $dbName | gzip > $backupFile";
-
system($command);*/
-
-
// hostname or ip of server
-
$servername='box.bluehost.com';
-
-
// username and password to log onto db server
-
$dbusername='username';
-
$dbpassword='password';
-
-
// name of database
-
$dbname='dbname';
-
-
////////////// Do not edit below/////////
-
-
connecttodb($servername,$dbname,$dbusername,$dbpassword);
-
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
-
{
-
global $link;
-
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
-
if(!$link){die("Could not connect to MySQL");}
-
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
-
}
-
-
for($i=0;$i<$count;$i++)
-
{
-
$sql="TRUNCATE TABLE `$table[$i]`";
-
$res=mysql_query($sql);
-
-
//$file = fopen("../mysql/data/backup/$table[$i].sql","r")or exit("Unable to open file!");
-
-
//some code to be executed
-
//here i am getting sql files.this path has to be correct
-
echo $backupFile = "../backup/$table[$i].sql";
-
-
$load="LOAD DATA INFILE '$file' INTO TABLE `$table[$i]` FIELDS TERMINATED BY ','";
-
echo $result=mysql_query($load);
-
//fclose($file);
-
}
-
//passthru("nohup mysql -u $dbusername -p $dbpassword $dbname < $backupFile");
-
echo "success";
-
-
?>
-
this code i am using.i didn't get any error message for path not given correctly.i understood the path was not given correctly .so that only its not working .i already given the path,where my sql file stored.how can i access the files.
code green 1,726
Recognized Expert Top Contributor
I honestly don't understand your problem.
.i understood the path was not given correctly
If you know the path is wrong why don't correct it?
how can i access the files
Which files where?
I am guessing the SQL file is not being found, but then there would be an error message...
Try using full paths rather than relative
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Geoff Soper |
last post by:
I'm having problem with images becoming corrupted after loading them into a
MySQL database and extracting them again. I'm pretty sure it's todo with
escaping slashes but I'm at a loss as to how to confirm this and find a
solution.
A piece of test code is below, the import script displays the image before
it goes in and then uses a second script to display it straight from the
database as well as extracting it to a file and displaying...
|
by: windandwaves |
last post by:
Hi Folk
I want my clients to load up a file to a MySql database. The file should
contain rows with
name, email, address, city
What would be the easiest way (in terms of the big picture), to get them to
upload it and put it in a mysql database?
|
by: den 2005 |
last post by:
Hi Everybody,
I am new at this group/forum. I am a .Net Programmer from Manila,
Philippines.
I like to ask anyone who can help me how to use mySQL database in
programming Visual Studio .Net Smart Device Application (.Net Compact
Framework). Specific question is it seems the System.Data namespace at this
application does not have the ODBC or OleDB namespace classes/objects. It
offers only for MS SQL CE. How can I go around this to be able...
|
by: goldwingers |
last post by:
Have a large 153400 KB MySql database to upload and have to break it up into 2048KB pieces and upload it thru the MySql admin 1 piece at a time. Is there any software that can speed up breaking the database into pieces for uploading? Its being uploaded to a shared server so no root access. Help is appreciated!
|
by: AHMLIVE |
last post by:
Hi everyone.
I got a problem when i tried to upload MYSQL database. I don't have any idea how to upload it. It is my first time to do it. I already upload the pages from my local pc to server with Bulletproof FTP transfer and now I want to upload my database. For now I am using vertrigoServ 2.15 and I found my database in folder path C:\Program Files\VertrigoServ2\Mysql\data\mydatabase. and i want it to transfer to my server.
Do I need...
| |
by: ammoos |
last post by:
hiiii friends...i want to upload some selected mysql datarecords from my offline system which is written in vb to online system which is made by asp.net with vb. i also want to make some processing on the uploaded data before it saveing to the online database... may i know how can i upload data to my on line sytem.. is it possible to make processing at the time of data upload.. i also want to know how to migrate data from the online database to...
|
by: fpcreator2000 |
last post by:
Hello everyone. I'm having problems with a page I've created that is used to insert data into a database.
It uploads two files into two distinct folder, and it takes the filenames and inserts them into a MYSQL database along with other product information.
Here is the entire .php file. I list it because the errors are not showing at all, and I need a fresh pair of eyes to look at it.
Any answers, critisims (constructive), or other talk...
|
by: updesigns |
last post by:
I am currently using a php form to update data into a mysql database. Am unsure how to use a php script to upload a file and copy the url link into the mysql database
|
by: xxoulmate |
last post by:
how to upload a database on the mysql server., i am using mysql version 4.0.1
that database is not yet existing in the server.
and that database in a format of file.sql(came from a mysqldump)
|
by: ahmurad |
last post by:
Dear Brothers,
I want to upload XLS/CSV huge data (90,000 rows in a XLS/CSV file) into MYSQL database.
I want to use only Import option of phpmyadmin to upload XLS/CSV files. How can i to do/proceed such task using this graphical interface (without php script).
I am awaiting for your kind replyto do this urgent task.
Thanks!!
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |