Hi All
Im trying to build a mysql restore script and I am having problems
Let me explain a little:
I have a form which uploads a “.sql” file to restore directory on the server, I then read and implode the .sql file into a variable, I then explode the variable into an array,
I print_r on the array and can view the complete contents. I connect to the mysql server and use a for loop to query the server. This is where I get error 1065 query empty.
Heres is the print_r results.
Array
(
[0] => -- phpMyAdmin SQL Dump
-- version 2.8.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Sep 28, 2006 at 05:46 PM
-- Server version: 4.1.20
-- PHP Version: 5.1.5
--
-- Database: `sitepoint`
--
DROP DATABASE `sitepoint`
[1] =>
CREATE DATABASE `sitepoint` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
[2] =>
USE `sitepoint`
[3] =>
-- --------------------------------------------------------
--
-- Table structure for table `gallery_photos`
--
DROP TABLE IF EXISTS `gallery_photos`
[4] =>
CREATE TABLE IF NOT EXISTS `gallery_photos` (
`photo_id` bigint(20) unsigned NOT NULL auto_increment,
`photo_filename` varchar(25) default NULL,
`photo_caption` text,
`photo_category` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`photo_id`),
KEY `photo_id` (`photo_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=60
[5] =>
--
-- Dumping data for table `gallery_photos`
--
INSERT INTO `gallery_photos` (`photo_id`, `photo_filename`, `photo_caption`, `photo_category`) VALUES (41, '41.jpg', '', 1),
(58, '58.jpg', '', 0),
(59, '59.jpg', '', 0)
[6] =>
)
I have noticed that array(6) is empty, and tested array 6, this is the one causing problems, I could remove array 6 some how but, I need to test various .sql files in order to determine that the last array is never needed…. I know this is checky, but if you don’t mind, can anyone / everyone email me ( piresl@gmail.com ) a .sql file for me to test this theory, I have a few .sql files here and the last array is always causing the problems, If your worried about the data, just delete it and send me the table structures.
Also how do I remove the last array, if this is the fix I need ?
Many thanks for reading a long post… I know sorry
Lozza