I try to dump my data thought php script but without command line. SO I create my .sql file with this script and then I try with my script:
$link = mysql_connect($host, $user, $pass);
mysql_select_db($name, $link);
$sqlFile = 'sql.sql';
$fsize = filesize($sqlFile);
$fopen = fopen($sqlFile, 'r');
$fread = fread($fopen, $fsize);
fclose($fopen);
mysql_query($fread) or die(mysql_error());
mysql_close();
When I try to dump data I got a error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE `ps_access` (`id_profile` int(10) unsigned NOT NULL,`id_tab` int(10' at line 1
But when I paste the sql in phpMyAdmin sql input tab theres no problem with this sql code:
DROP TABLE IF EXISTS `ps_access`;
CREATE TABLE `ps_access` (
`id_profile` int(10) unsigned NOT NULL,
`id_tab` int(10) unsigned NOT NULL,
`view` int(11) NOT NULL,
`add` int(11) NOT NULL,
`edit` int(11) NOT NULL,
`delete` int(11) NOT NULL,
PRIMARY KEY (`id_profile`,`id_tab`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
So where is my error in php script and how to fix it to dump the data?
Avarage SQL file is ~800KB
Best regards, George!