iyeru42 Posted August 8, 2008 Share Posted August 8, 2008 ((See post under Deirdre's Dad's, still not fixed yet though)) Link to comment Share on other sites More sharing options...
Synook Posted August 9, 2008 Share Posted August 9, 2008 What exactly is the error? Link to comment Share on other sites More sharing options...
iyeru42 Posted August 9, 2008 Author Share Posted August 9, 2008 What exactly is the error?No wait, that was a previous error. Sorry, there is no error log data for this. There's an error, but it's just blank. Not even the error log has the information. Link to comment Share on other sites More sharing options...
jeffman Posted August 9, 2008 Share Posted August 9, 2008 Man, you post SO MUCH code. Can't you narrow it down?I see you have error reporting turned on, but you get no errors. Usually that means the script isn't parsing and your server isn't configured to report errors on its own. If the script doesn't parse, it doesn't run, so the error reporting statement is ignored.Here's the work-around.Try including the suspicious files in a small, perfectly written script that has its error reporting turned on. Just a couple lines: report errors, include this file, include that file, done. You should get a report that includes the first parsing error, the name of the bad file, and a line number. Link to comment Share on other sites More sharing options...
iyeru42 Posted August 9, 2008 Author Share Posted August 9, 2008 Actually, I have narrowed it down finally. // Executes a given file as semicolon-terminated SQL statements.function ExecuteSQL($filename){ global $filename; // Get contents of the file. $filedata = file_get_contents($filename); if($filedata === FALSE) { return FALSE; } // Explode statements into elements of an array. $aSQL = explode(';', $filedata); // Execute each of the queries. foreach($aSQL as $strSQL) { if(trim($strSQL)) { if(!mysql_query(trim($strSQL))) { return FALSE; } } } return TRUE;} and // Execute the installation SQL script. if(ExecuteSQL("./includes/install.{$aDBInfo['type']}")) { // Mark us as having executed the SQL script. $sql_complete = TRUE; } else { // Couldn't execute install.sql. return("Could not execute <code>install.{$aDBInfo['type']}</code>.<br /><b>Database says</b>: ".$dbConn->geterror()); } are the problems. Removing them makes the php file work. having these in, causes my PHP file to output blank after it got to actually executing ExecuteSQL. But I need to execute huge amounts of queries... huge tables... etc.I tried the following instead: // Execute the installation SQL script. function parse_mysql_dump($url){ /* $link = mysql_connect($nowhost, $nowuser, $nowpass); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db /* $db_selected = mysql_select_db($nowdatabase, $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } */ $file_content = file($url); foreach($file_content as $sql_line){ if(trim($sql_line) != "" && strpos($sql_line, "--") === false){ //echo $sql_line . '<br>'; mysql_query($sql_line); } } } But it didn't work, no tables, etc. were created, nothing was inserted into, and no errors resulted. Why? Because the above function doesn't find anything, since it isn't looking for semicolons. That stuff is all commented out because I connected to the DB beforehand (no, no DB errors resulted.)Here's example data with install.mysql: CREATE TABLE `filetypes` ( `name` varchar(255) NOT NULL default '', `image` varchar(255) NOT NULL default '', `mime` varchar(255) NOT NULL default '', PRIMARY KEY (`name`));INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('bmp', 'bmp.png', 'image/bmp');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('gif', 'image.png', 'image/gif');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('jpg', 'image.png', 'image/jpeg');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('jpeg', 'image.png', 'image/jpeg');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('png', 'image.png', 'image/png');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('txt', 'text.png', 'text/plain');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('zip', 'zip.png', 'application/zip');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('rar', 'rar.png', 'application/x-rar-compressed');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('gz', 'gzip.png', 'application/x-gzip');INSERT INTO `filetypes` (`name`, `image`, `mime`) VALUES ('7z', '7zip.png', 'application/x-7z-compressed'); Link to comment Share on other sites More sharing options...
boen_robot Posted August 9, 2008 Share Posted August 9, 2008 Have you tried what Deirdre's Dad suggested? <?phpini_set('display_errors', 'On');include 'theProblematicFile.php'; //Adjust this to the name of the file?> What errors show up then? Link to comment Share on other sites More sharing options...
iyeru42 Posted August 9, 2008 Author Share Posted August 9, 2008 After I fixed another error stating $dbConn wasn't a valid variable, the error page I created that set display_errors on no longer displays errors, and still shows a blank page.Seems it was the "return" in the if/else down south where ExecuteSQL was executed. (It isn't a function, so the if/else cannot return anything.) Well, thanks for trying you guys. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.