Hello guys I'm startled. I have sql code in a file, exported from phpMyAdmin. I read the text from this file in php in order to execute it, but isn't executed and says: "error near ' " When typing in the code in the php 1 to 1, it works, when copying the code in phpMyAdmin it works ... and it is not too long, i tried short expamples... I don't get where the problem could be, does anybody know this problem, have a hint respectively???? Thanks for any motivation
ok. when i wrote this i didn't have the code... but here it is (sorry, that i'm only responding now. i tought i had subscribed to this thread...but i have not.) i repeat: if i type the sql query exactly the same by hand, it works... $sqlbuffer = Array(); $newsqlbuffer = Array(); $handle = @fopen("installation/tables.sql", "r"); if ($handle) { while (!feof($handle)) { $buffer[] = fgets($handle, 4096); } fclose($handle); } foreach ($buffer as $line){ if ( preg_match("/^\\s*(insert|create) /i",$line) ) { $newline = ereg_replace('(.+)(#PFIX#)(.+)', '\\1'.$my_db['prefix'].'\\3', $line); }else{ $newline = $line; } $newline = str_replace("\r\n", " ", $newline); $newline = str_replace("\r", " ", $newline); $newsqlbuffer[] = $newline; } foreach ($newsqlbuffer as $line) $sqlquery .= $line; $dbinstance = new bDb(); $dbinstance->query($sqlquery); PHP: in the file tables.sql is f.ex. this: -- settings CREATE TABLE IF NOT EXISTS `#PFIX#_settings` ( `setting` tinytext collate utf8_unicode_ci NOT NULL, `value` tinytext collate utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `#PFIX#_settings` (`setting`, `value`) VALUES ('lang', 'de'), ('admins', '1:'), ('email', ''), ('formlines', '12'), ('style', 'zock_standard'), ('name', 'Zock!'), ('description', 'The Betting Office'), ('account_type', 'Account'), ('account_details', 'xx-xxx-xxx.xx'), ('account_holder', 'My Name\r\nMy Street\r\nMy ZIP-Code and Town\r\nFuther Info'), ('notify_newaccount', 'true'), ('functionalSMTP', 'false'), ('site_url', ''), ('notify_participate', 'true'), ('notify_withdraw', 'true'), ('notification_system', 'internal'); Code (markup):