Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Copy And Paste On MySQL To MySQL Database


Would there be any issues if i literary Copy and Paste a mysql db from one server to another mysql db server? When i say "copy and paste" is just like tranferring one word doc from one pc to another pc.

I tried the copy and paste already and the new server had recognize the DB i had pasted. I just want to confirm if there would be issues doing it so.. Or should i use Mysql.com Migration toolkit?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Copy/Paste Anomaly
Whenever I copy and paste code from my browser into my editor of choice, then upload it to my server, the code doesn't go in right. However, if I retype the exact same code and then save the file, upload it again, it works okay. But this defeats the purpose of copy/paste.

Yes, I uploaded the file as ascii. No, there aren't any weird characters are codes that show up. I'm running MacOS 9.1 and Internet Explorer 5.0. I haven't tried copying and pasting the code on Netscape. Has anyone had this problem?

Mysql Data Copy
I have mysql table1 on my local comp. It looks something like this.

----------------------------------------------------------------------------
-
broj_tel | poruka | sifra |
grad | id |
----------------------------------------------------------------------------
|
+385912701600 0 Zprod rijeka
5 |
----------------------------------------------------------------------------
|
+385912701699 1 kprod crikvenica
3 |
----------------------------------------------------------------------------
-

On the remote server (web hosting) i have table2 looking something like
this:

----------------------------------------------------------------------------
---------
id_independant | Name | Surname | broj_tel
| poruka |
----------------------------------------------------------------------------
--------- |
11122 Martin Johnes
+385912701600 1 |
----------------------------------------------------------------------------
----------|
16163 John Doe
+385912701699 0 |
----------------------------------------------------------------------------
----------

Question: I nead periodicly (some scheduler, my concern) to make something
like this:

select * from table1
insert into table2 (poruka) whare table1.broj_tel = table2.broj_tel

To read the data from table1, and inserts into table2 coloumn poruka whare
tabel1.broj_tel i equal table2.broj_tel
Problem is that the data is in diferent databases.

How To Copy Mysql Tables Between Two Servers?
I want to copy certain tables from server to server b.
How do I make it fastly and efficiently with PHP?
I wrote below my current start, but it may not be the best approach.

Perttu Pulkkinen, FINLAND
----------------------------
<?
$host_A = "xxx";
$user_A = "xxx";
$pass_A = "xxx";
$base_A = "xxx";

$host_B = "yyy";
$user_B = "yyy";
$pass_B = "yyy";
$base_B = "yyy";

$tables = array(""this", that", "those", "them");

$link_A = mysql_connect($host_A, $user_A, $pass_A);
or die("Yhteys tietokantaan A epäonnistui! : " . mysql_error());
$link_B = mysql_connect($host_B, $user_B, $pass_B);
or die("Yhteys tietokantaan B epäonnistui! : " . mysql_error());

mysql_select_db($base_A, $link_A) or die("Tietokannan A valinta
epäonnistui!");
mysql_select_db($base_B, $link_B) or die("Tietokannan B valinta
epäonnistui!");

foreach($tables as $table)
{
$qid_A = mysql_query("SELECT * FROM $table", $link_A)
or die("Haku tietokantaan A epäonnistui! : " . mysql_error());
$qid_DEL_B = mysql_query("DELETE FROM $table", $link_B):
or die("Taulun tyhjennys tietokannassa B epäonnistui! : " .
mysql_error());

Php/Mysql- Uploading Mysql Database
I've set up a basic database using Mysql (just creating a web blog I followed a tutorial) and then started writing the php code for interacting with the database. how do I put the Mysql database onto the the web server where I have server space (the server I use is just some company that I pay €100 a year for). I need the php file to get the data from the Mysql database...

What Is Indexing In Mysql And How It Will Be Useful And How We Can Retrieve Database Content Easily From A Database Table Containing About 5lakhs Datas
I need to select data from a database table containing huge amount of
data. Now I am storing data using one primary key and I am just using
simple select statement, and this process gives me the output but it is
taking long to execute the query. As much I had heared I want to use
some indexing or cluster indexing which might help me but I am not so
familiar with these things.

Reading An Array Of Records From MYSQL Then "Save As" Them Back As Copy
Hi all,

Ok here is what I want to do then I will show you what I have. I have some records in a MySQL DB that I want to store in an array and then immediately copy them back where the only thing that would change would be one field - the date. So here is my table:
-------------------------------------
|userName | date | value |
--------------------------------------
| theDano | 200005 | 123 |
--------------------------------------
| theDano | 200005 | 345 |
--------------------------------------
| theDano | 200004 | 678 |
--------------------------------------
| joeUser | 199908 | 897 |
---------------------------------------

So if I am querying for the user "theDano" on a specific date (format yyyymm) in this case 200005 (year 2000 month of May)

Here is my array to query all records to fullfill this request:

if ($update=="future")
{
if ($month!="01")
{
$db = mysql_connect("localhost", "dbuser");
if($db)
{
mysql_select_db("dbName",$db);
$result = mysql_query("SELECT * FROM tableName WHERE userName = '$userName' AND date = '$date' ORDER BY value DESC ",$db);
if ($result)
{
$num=mysql_numrows($result);
$i=0;
while($i < $num)
{
$userName = mysql_result($result,$i,"userName");
$value = mysql_result($result,$i,"value");
echo "<tr>";
echo "<td width=Ê×'>" . $userName . "</td>";
echo "<td width=ï`'><div align='right'>" . $value . "</div></td>";
echo "</tr>";
++$i;
}
}
}
}
}

Now I want to take the array of records queried which was:

| theDano | 200005 | 123 |
--------------------------------------
| theDano | 200005 | 345 |

and copy them to look like this back into the database:

| theDano | 200006 | 123 |
--------------------------------------
| theDano | 200006 | 345 |

so you can see that the only thing changed was increasing the month by one. Would seem simple to most but I am having a tough time wirting the code to read the array and increase each date value by "1".

Thank you in advance for anyone that replies. )

Dano

Need Script To Copy A Database And All It's Tables
My database contains 45 tables the structure of which is evolving as I
develop. I need a utility that will "read" the structure of this
database and it's tables and then create an identical database with
all tables.

Getting A Value From MYSQl Database
I want to get the value from a field in the database using the following PHP code:

$sql = "SELECT Paper_id from Papers WHERE Title= '$Paper_Title'";
$PaperID = mysql_query($sql);

However this returns some wierd response: "Resource id #2" how do I just get the value of the field in my new selected table which is 1*1.

Help With MySQL Database Retrieval
I am a total newbie and I am having problems retrieving multiple rows from a database...

when I try to get a printout of the whole table, I get the following error:

Warning: 0 is not a MySQL result index in C:HTTPDHTDOCStest.php3
My code is as follows:

<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("test",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>n";
echo "<tr><td>Name</td><td>Position</td></tr>n";
do {
printf("<tr><td>%s %s</td><td>%s</tr>n", $myrow["first"], $myrow["last"], $myrow["address"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>n";
} else {
echo "Sorry, no records were found!";
}
?>

Check To See If Value Is Already In Mysql Database
I am looking for the most efficient way to check and see if an inputed email (via form) is already in the database under the column 'Email'.

Pdf Files In A Mysql Database
I have a mysql database which I reach with php-code.

I want to be able to download and open files I have stored(as a BLOB) in the database. Downloading and opening word documents and textfiles give no problems, but PDF-files aren't possible to open.

Has anybody the same troubles, or does anybody know a solution for this problem?

Insert Into Mysql Database
It sounds very simple, but for some reason I just can't figure it out, and it will save a lots of time to me, if someone can direct me into the right direction. I was trying to input data into mysql table through post method, but it was not working. I made it simple and just tried to enter anything from a php file, but it does not work, so there is something that i am doing wrong with the insertion query.

$link = mysql_connect($hostName, $userName, $password);
echo("connected");

mysql_select_db($databaseName, $link);
echo("database selected");
echo ($databaseName);

mysql_query("INSERT INTO image VALES('','','','','','','','','', 'hello', '', '', '','','','','')", $link);

echo ("done");

I am trying to enter into one of those fields, but it does not populate the table in mysql database.

Cant Connect To Mysql Database
I'm having a problem connecting to a database, when i use the following script to connect to a database (all the login details are correct) it connects to mysql but says it can't connect to the database any body got any suggestions...

Creating A New MySQL Database
I run a small horse racing based website that has a 'fantasy league' type competition each season. Last year i looked after all the entries, leaderboards etc.. using excel and copying and pasting to webpages each week.

However this year i am going to attempt to use MySQL and PHP to have it automatic bar result entry. I have built a basic php and MySQL site before with the usual insert, edit etc.. But this one will need features im not sure how i go about making.

Basically there will be a list of horses (around 150) divided into 4 grades. Entrants pick 2 horses from each grade so a total of 8 horses. Winning horses score 5, 2nd = 3 and 3rd =1.

I was thinking of having the following 2 tables - one for the horses - listing their name and grade. One for entrants - the peoples contact details and their chosen horses.

However from there im not sure how to able to enter the latest results and how i can create a leaderboard page and list the points each horse has. I was thinking of a new table with a row for each result showing horse name and points scored but i then dont't know how this table can be used to create a column on the horse table that lists each horses total points. And also how it can be used to create the total points each entranant has got so far (i.e. the total point for all 8 of their horses)

Mysql Database Problem
I installed php4,MySQL,Apache on my Windows98 system. Everything works up to the point of connecting to Mysql. Then I can't get it to do anything else.
this works to connect:

$connection = mysql_connect("localhost", "user", "xxxxxxxx")
or die ("couldn't connect");
if ($connection) {
$msg = "success!";}?>
But when I try to anything like create a database I get the errors (in this case 'couldn't create database'.)

<?
$new_db = "cosmos";
$connection = @mysql_connect("localhost", "user", "xxxxxxxxx") or die ("Couldn't connect.");
$result = @mysql_create_db($new_db,$connection) or die ("Couldn't create database");
if ($result) {$msg = "<p>Database has been created</p>";}?>


Create Mysql Database?
How do I make PHP create a database for mysql please?

I can see how to make tables and I have read all the documents
I can find but I don't understand how to make the database itself.

All the tutorials I can find seem to bypass the issue by ignoring it?

Copying From One Mysql Database To Another
Is it possible to open a connection to two separate mysql databases in order to copy the data from one table in the first database into a table in the second database? I'm assuming the answer is yes, but I'm confused as to the proper php syntax.

Pictures Into A MySQL Database
I need to put pictures in to a MySQL -database with PHP and also be able to view them on a web page with PHP.

How I Setup My Mysql Database(s)...
Quick question on how I setup my mysql database(s)...

If my setup is such that I have multiple clients, and each client gets
10 tables to store their data, is it better for performance if I put all
of these tables into 1 large database (with a unique identifier
prepended to each one) or create a separate database for each client?
i.e., assuming 1000 clients, I either would have:

A) 1 database and 10,000 tables in it, 10,000 total tables

B) 1000 databases with 10 tables in each, 10,000 total tables

Intuition tells me that the multiple databases would be better for
isolating data between clients, but I am not sure if this would slow
things down.

All the info I found on this online was inconclusive and mostly was
people speculating, so I hoped you all could help more.

MySQL Country Database
Is there anyone out there willing to donate their country table fora web database. I have been looking all over for a sql script to create a country table populated with recent data, but I just can't seem to find one. People must do this ALL the time.

Parsing PHP From A MySQL Database
i am creating a CMS and i have a setup so you can add sections and they get stored in a db then you can call them with index.php/section. however this doesn't work right if you have PHP in the content of the section. the PHP code shows up instead of getting parsed.
PHP Code:

PHP/MySQL Bugs Database
Anyone know of a good, cheap PHP/MySQL bugs database around?
$100 kind of range.

MySQL Busiest Database
Is there a way (perhaps by using PhpMyAdmin?) to see which MySQL database is
getting the most queries on a server?

XML Datas To MySQL Database
Where to find a comprehensive document on how take datas from XML and put
them in a Mysql Database.
I've many sites sending us XML files. We have to parse datas and save those
datas on Mysql.

The problem is that we have many different file format (each company sends
us it's own XML structure).

How to provide a simple way to get those datas in Mysql, without having to
create a new PHP script for every new site's XML ?

Poll Without A MySQL Database
I'm trying to create a poll that uses a simple *.txt file as a "database". And I'm wondering how to do the following things:

1) How to open the *.txt file;
2) How to list each answer-option;
3) How to add 1 to the selected asnwer-option;
4) How to save the data to the *.txt again;
5) How to close the file.

XML Feed From Mysql Database With PHP
I'm finding myself with the task of writing a php script to automatically compile an XML feed with some standard tags and some tags with data taken from a MySql database.

How Often Do I Need To Connect To MySQL Database?
At present at the top of each of my php pages I reconnect to my
database

mysql_connect(...);

is that actually necessary/good practice. Isn't there something about
persistent connections.

MySQL Database Backup
I'm looking at using PHP and MySQL for a particular website application.
However, I was a bit concerned that if a PHP script went wrong then it would
be possible to accidentally delete or overwrite large chunks of the data in
the database which presumably would then be lost. What is the usual
procedure for these situations?. Is it possible to back up a database
somehow so that data from a previous time can be retrieved?.

Changing A Row In A Mysql Database
I was just wondering, once you have a row in a certain column set....how do you change it with php for example i have a column named "cookie_hash" in my table...when the user logs in i want to update it every time with an md5 hash of their email and login time..I just dont know how to do so

I have this part $hash= md5($email.date ("l dS of F Y h:i:s A")); But I just dont know how to do the query.

Backup MySQL Database
How does one go about using cron jobs to create a MySQL database dump each evening?

I have cPanel with my hosting and when i go to cron jobs i have a 'Command to run:

Getting Results From MySQL Database In PHP
I am trying to write a php page which connects to a MySQL
Database which is supposed to get the results from a table within a
database and display the results in a table.

Below is the code that I am using:

Images In MySQL Database.
I really do not want to put images in my database, but I want to be able to have a script where users can upload an image, and it will be stored in a database (the file name, name of owner, and the trick performed). Then it will be placed in a gallery.

Passwording A MySQL Database
I have a PHP query for a MySQL database that I'd like to restrict
access to. It's linked from a .htm webpage with other links on a
company intranet site.

Does anyone know of any PHP code examples on the net to perform such a
task? I have to think it's a pretty common application for
passwording in PHP.



Connect To MySQL Database Using PHP
I am trying to connect to a MySQL Database using PHP on a
local machine using locahost. I am using the following code

<?php
$dbhost = 'localhost'
$dbuser = 'root'
$dbpass = 'password'

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or
die ('Error connecting to mysql');

$dbname = 'pmoneytest'
mysql_select_db($dbname);
?>

When I view the page it then comes up with an error that says
PHP Fatal error: Call to undefined function mysql_connect() in C:
InetpubwwwrootPHPTestconnection.php on line 6. I can't see what
the problem is as I got the code from the Internet and it seems to be
the same on all the different website that I look at.

Sessions VS. MySQL Database
I was wondering what would be better for computer resources and speed wise if lets say I got about anywhere from 3,000 - 6,000 people on my site at once if I:

Loaded information from mysql once and then loaded the needed variables into the the SESSION variable (Things like if you want to receive emails, your signature in a forum) -- OR -- Loaded the information from mysql as often as possible and keep the minimal amount of variables inside SESSION (Things like UserID, AuthID)

Php Mysql Database Connection
i want to add my form details to the mysql database. i had done it with mysql_connect('localhost','root',''); but the error was localhost connection failed. Code:

Searching Mysql Database
i and have started building my first database driven site. The database has 8 tables that contain info on my shop in Portugal. I have finished off 90% of the sites interaction with the database and the last thing i want to do is a simple database search. i.e a text field and button on the home page that will search the entire database for keywords, if those keywords are found in the title or description of any of my entries they will display the results on a new page.

I have tried looking for tutorials but all i have found are complex searches with options for boolean and normal (which i do not want). Can anyone point me in the direction of a tutorial that produces a simple multi column, multi table search that displays results.

Changing MySql Database
Is there a way to change a Mysql database so the if the "result" column= win and a link is clicked to change it it automatically changes to lose without the user have to type anything/click anything. (Also vice versa).

How Could I Get Numbers From A Mysql Database And Add Them Up
how could I get numbers from a mysql database and add them up(if possible)?

Like using a id from a different table and then for each id entry in the first(not the different) table adding the numbers.

Printing From A Mysql Database
I am a newbie to PHP but have been set a task to use the MYSQL database I have created and be able to print information from it using PHP but the problem is I amnot sure where to start.

Export Whole MySql Database
I am looking for the straightest way to export a whole MySql database, but
all I can find is SQL statements to export specific tables....

Editing MySQL Database
I've got website running happily using XAMPP 1.4.15

However, I desperately want to upgrade to the latest XAMP 1.6.1

The problem I'm having after the upgrade is with a php page that lets me edit users. I can add users ok but if I try to edit them, all the cells in that row end up empty. There's no error message which makes it difficult to diagnose.

At first, I thought the reason was due to the new XAMPP having MySQL 5.0.37. I upgraded XAMPP 1.4.15 to MySQL 5.0.37 and it still worked perfectly. There's something in XAMP 1.6.1 which isn't compatible with my php code. I even tried  XAMP 1.6.1 with PHP 4.4.6 but I still had the same problem.

PHP MySQL Database Connection
I'm involved in a project where I have to create a web application with PHP and MySQL. My question is, usually we use one user name and password to connect to the database for the whole application, in which case all the users will connect to the database with that username we set in PHP script.

If we want to have different users with various access rights on the database this strategy will not work, because we give one username and give maximum access rights for that username. Is there any way where you can define the access rights of a user in the database(MySQL) and use the same username and password when the user connects to database through PHP application?

If so, we will have hundreds of users connecting through the PHP application with different usernames and password, will this have any impact on the web server or DB server? Is it secure? Is there any other way this can be done?

Cut And Paste From Sql
i have an old sql file from phpbb lines are like this;

INSERT INTO `phpbb_users` VALUES (702, 1, 'Harley Beau', '827ccb0eea8a706c4c34a16891f84e7b', 0, 0, 0, 1185428727, 0, 0, -12.00, 1, 'albanian', 'D M d, Y g:i a', 0, 0, 0, 0, 0, NULL, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, '', 0, '57b16b7c49@todoscol.org', '', 'http://www.seamcat.org/xwiki/bin/download/XWiki/NoraMilton/amateurpics.html', 'Somethere', '', '', '', '', '', '', '', '', NULL);

INSERT INTO `phpbb_users` VALUES (703, 1, 'Fertassal', '91f004cf5aa5e8f7580b3a8001b17acd', 0, 0, 0, 1185473363, 0, 0, -12.00, 1, 'albanian', 'D M d, Y g:i a', 0, 0, 0, 0, 0, NULL, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, '', 0, 'fertassa@mail.ru', '135664', 'http://www.mulka.ru', 'Russia', '', '', '', '', '', 'news and links', 'download MP3', '', NULL);

i would like to create a new text document and copy paste only email addresses from this sql file.. Text Doc. will be like this;

57b16b7c49@todoscol.org
fertassa@mail.ru

any idea?

Secure MySQL Database Updation Through PHP
I am in the process of developing an applicaiton based on PHP and MySQL. My application requires that the visitors should be allowed to alter those records of a table which have their UserID value. The users will log in using their UserID and a Password which is stored and authenticated from a separate table. Can someone guide me as to what is the best way to implement this.

Parsing Output From MySQL Database Through Php
Hi All,

I want to put php pages in a MySQL database, and then get the output parsed by php. Getting the pages in MySQL is no problem, but the output is only displayed, not parsed.

Store Sessions In MySQL Database.
I would like to use the PHP session feature, but instead of storing the session data in a file, I would like it to save it in a MySQL database. Is this possible?

Saving To MySQL - Music Database - Help?
I'm writing a CD database for myself. On a page, once the album title and general info is entered, depending on the number of songs entered, ($num_songs) after you submit the form, the variable is passed to the next page with the following code and the appropriate number of spaces are shown ready for the song titles to be entered.

for($n = 1; $n <= $num_songs; $n++) {
print "<tr bgcolor=ffffff><td>Song $n: </td><td align=center><input type=text name=songname$n size=40 maxlength=70></td></tr>
";
}

I've tried a few things but have had no luck at getting the actual song titles ($songname$n) to post to the database. The songs numbers do, however. I do want each song to save with its own unique ID and own name, song number, the album ID as entered in the previous screen etc.

Updating A Record In A Mysql Database
I am sorry if this is a simple oversight, but I have been struggling for many hours over something which seems dead simple.

I need to update a record in a table with more info. I am using the code below which soen't give me any errors but nothing happens.

include("link.inc");
$db=connect_db();
$db_name=db_name();
mysql_select_db($db_name,$db);

$sql="UPDATE data SET age='age',live='live',whatdo='whatdo',drinkalcohol='drinkalcohol',takedrugs='takedrugs',firstdrug='f irstdrug',seconddrug='seconddrug',medicine='medicine',alcohol='alcohol' WHERE id='$id'";
$result=mysql_query($sql,$db);


Copyright © 2005-08 www.BigResource.com, All rights reserved