Hi,
I would apprectiate some help with a couple of database questions I have. I think its just me thinking “wrong” in which case the answer could be quite simple.
Im trying to copy a database containing all content from one server (well locally at the moment using XAMPP) to another (online). Fortunately I have phpMyAdmin and initially thought I could simply do an “operation” such as “copy Database to” that copies the entire “shabang” but its appearing to be more difficult than I imagined.
Using the above option some code is generated along these lines:
SQL query
CREATE TABLE `test`.`foo` (
`ID` int( 255 ) NOT NULL AUTO_INCREMENT ,
`PARENT_ID` int( 255 ) default '0',
`TITLE` varchar( 255 ) COLLATE latin1_general_ci default NULL ,
`SRC` varchar( 255 ) COLLATE latin1_general_ci default NULL ,
`WIDTH` int( 15 ) default '0',
`HEIGHT` int( 15 ) default '0',
`COMMENTS` text COLLATE latin1_general_ci,
`OTHER` varchar( 50 ) COLLATE latin1_general_ci NOT NULL default '',
`COLORS` varchar( 50 ) COLLATE latin1_general_ci NOT NULL default '',
`SPECIAL` char( 3 ) COLLATE latin1_general_ci NOT NULL default 'no',
PRIMARY KEY ( `ID` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 COLLATE = latin1_general_ci
Below this is a “create PHP code”, wow thinks me, this will make things easier, and click, but I keep getting an error saying the database already exists (probably from the first operation I carried out?
My second problem is that the table itself is getting duplicated but only locally like:
INSERT INTO `phpgall`.`my_test2`
SELECT *
FROM `phpgall`.`plasmado` ;
or can I select a remote location? If so, how?
Or is there a SQL command somewhere that generates the current SQL table information, and generates my copying code like this:
INSERT INTO `my_test2` ( `ID` , `PARENT_ID` , `TITLE` , `SRC` , `WIDTH` , `HEIGHT` , `COMMENTS` , `OTHER` , `COLORS` , `SPECIAL` )
VALUES (
'', '0', 'itle', 'a src', '0', '0', NULL , '', '', 'no'
);
Although Im no expert with PHP I always seem to acheive my aim in the end, but as soon as mySQL comes into play...it all goes pairshaped.
I would appreciate any pointers.
Cheers,
Flash-Genie