473,698 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to upload mysql database to my serverspace in programming

16 New Member
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
Sep 28 '10 #11
neelsbr
16 New Member
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  require_once('library/config.php');
  3.  
  4. $dbHost = 'localhost';
  5. $dbUser = 'username';
  6. $dbPass = 'password';
  7. $dbName = 'dbname';
  8.  
  9. $today=date('Y/m/d');
  10.  
  11. $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');
  12.  $count=count($table);
  13. for($i=0;$i<$count;$i++)
  14. {
  15.  
  16. $backupFile = "backup/$table[$i].sql";
  17. $query      = "SELECT * INTO OUTFILE '$backupFile' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' FROM `$table[$i]`";
  18. $result = dbQuery($query);
  19.  
  20. }
  21.  
  22. /*$backupFile = $dbName . date("Y-m-d-H-i-s")  .'.gz';;
  23. echo $command = "mysqldump --opt -h $dbHost -u $dbUser -p $dbPass $dbName | gzip > $backupFile";
  24. system($command);*/
  25.  
  26. // hostname or ip of server
  27. $servername='box.bluehost.com';
  28.  
  29. // username and password to log onto db server
  30. $dbusername='username';
  31. $dbpassword='password';
  32.  
  33. // name of database
  34. $dbname='dbname';
  35.  
  36. ////////////// Do not  edit below/////////
  37.  
  38. connecttodb($servername,$dbname,$dbusername,$dbpassword);
  39. function connecttodb($servername,$dbname,$dbuser,$dbpassword)
  40. {
  41. global $link;
  42. $link=mysql_connect ("$servername","$dbuser","$dbpassword");
  43. if(!$link){die("Could not connect to MySQL");}
  44. mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
  45. }
  46.  
  47. for($i=0;$i<$count;$i++)
  48. {
  49. $sql="TRUNCATE TABLE `$table[$i]`";
  50. $res=mysql_query($sql);
  51.  
  52. //$file = fopen("../mysql/data/backup/$table[$i].sql","r")or exit("Unable to open file!");
  53.  
  54. //some code to be executed
  55. //here i am getting sql files.this path has to be correct
  56. echo $backupFile = "../backup/$table[$i].sql";
  57.  
  58. $load="LOAD DATA INFILE '$file' INTO TABLE `$table[$i]` FIELDS TERMINATED BY ','";
  59. echo $result=mysql_query($load);
  60. //fclose($file);
  61. }
  62. //passthru("nohup mysql -u $dbusername -p $dbpassword $dbname < $backupFile");
  63. echo "success";
  64.  
  65. ?>
  66.  
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.
Sep 29 '10 #12
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
Sep 29 '10 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3528
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...
1
1785
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?
1
2247
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...
0
1339
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!
3
11675
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...
0
892
ammoos
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...
6
2173
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...
1
3269
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
1
1208
xxoulmate
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)
0
2257
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!!
0
8609
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,...
0
9170
Oralloy
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...
1
8901
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,...
0
8871
tracyyun
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...
0
7739
agi2029
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...
1
6528
isladogs
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...
0
4371
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...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.