d22552000 Posted August 14, 2007 Share Posted August 14, 2007 OMFG line 13218. I am inserting a LARGE sql syntax (3.5 MB) into a databse based on dynamic data... (Do you know how to do the source command from php, cause i get: invalid syntax by :/ ) SQL.php source below (minus the sql) <?PHP function sql($DB) { $g_link = mysql_connect( '127.0.0.1', 'root', '') or die('Could not connect to server.' ); mysql_select_db($DB, $g_link) or die('Could not select database.'); $sql = ' /* 3.5MB of mysql queries */ '; mysql_query($sql, $g_link) or die('Could not perform SQL.' . mysql_error();echo 'End of SQL.'; mysql_close($g_link); } ?> Lines 13217-13219: (68, -1, \'bbcode_code\', \'<div style="margin:20px; margin-top:5px">\r\n <div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:</div>\r\n <pre class="alt2" dir="ltr" style="\r\n margin: 0px;\r\n padding: $stylevar[cellpadding]px;\r\n border: 1px inset;\r\n width: $stylevar[codeblockwidth];\r\n height: {$blockheight}px;\r\n text-align: left;\r\n overflow: auto">$code</pre>\r\n</div>\', \'<div style="margin:20px; margin-top:5px">\r\n <div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:</div>\r\n <pre class="alt2" dir="ltr" style="\r\n margin: 0px;\r\n padding: $stylevar[cellpadding]px;\r\n border: 1px inset;\r\n width: $stylevar[codeblockwidth];\r\n height: {$blockheight}px;\r\n text-align: left;\r\n overflow: auto">$code</pre>\r\n</div>\', \'template\', 1164202755, \'Kier\', \'3.6.4\', \'vbulletin\'), (69, -1, \'bbcode_code_printable\', \'<div style="margin:20px; margin-top:5px">\r\n <div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:</div>\r\n <hr /><code style="margin:0px" dir="ltr" style="text-align:left">$code</code><hr />\r\n</div>\', \'<div style="margin:20px; margin-top:5px">\r\n <div class="smallfont" style="margin-bottom:2px">$vbphrase[code]:</div>\r\n <hr /><code style="margin:0px" dir="ltr" style="text-align:left">$code</code><hr />\r\n</div>\', \'template\', 1136596081, \'freddie\', \'3.6.0 Beta 1\', \'vbulletin\'), (70, -1, \'bbcode_html\', \'<div style="margin:20px; margin-top:5px">\r\n <div class="smallfont" style="margin-bottom:2px">$vbphrase[html_code]:</div>\r\n <pre class="alt2" dir="ltr" style="\r\n margin: 0px;\r\n padding: $stylevar[cellpadding]px;\r\n border: 1px inset;\r\n width: $stylevar[codeblockwidth];\r\n height: {$blockheight}px;\r\n text-align: left;\r\n overflow: auto">$code</pre>\r\n</div>\', \'<div style="margin:20px; margin-top:5px">\r\n <div class="smallfont" style="margin-bottom:2px">$vbphrase[html_code]:</div>\r\n <pre class="alt2" dir="ltr" style="\r\n margin: 0px;\r\n padding: $stylevar[cellpadding]px;\r\n border: 1px inset;\r\n width: $stylevar[codeblockwidth];\r\n height: {$blockheight}px;\r\n text-align: left;\r\n overflow: auto">$code</pre>\r\n</div>\', \'template\', 1164202759, \'Kier\', \'3.6.4\', \'vbulletin\'), and yes, I escaped all 106219 ' symbols.[/code][/code][/code][/code] Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/ Share on other sites More sharing options...
d22552000 Posted August 14, 2007 Author Share Posted August 14, 2007 please people... -,-. Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323771 Share on other sites More sharing options...
lemmin Posted August 14, 2007 Share Posted August 14, 2007 Are those three lines in an sql query? What kind of crazy function takes arguments like that? I think you should show more code around those lines, especially whatever code shows what those line are encapsed in. Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323778 Share on other sites More sharing options...
d22552000 Posted August 14, 2007 Author Share Posted August 14, 2007 those are three lines in mysql, but can usee any thing thta PHP might object to? ie. unescape ' keys or anything else? Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323782 Share on other sites More sharing options...
lemmin Posted August 14, 2007 Share Posted August 14, 2007 That is why I would have to see the entire command. Since they are lines in your mysql, I can only assume they are supposed to be strings. Those strings contain all kinds of quotations that would end and restart the string. Try to replace all those quotations with \" like you did with the single quotes. Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323808 Share on other sites More sharing options...
kenrbnsn Posted August 14, 2007 Share Posted August 14, 2007 How did you escape the single quotes? By hand? Or did you use the function mysql_real_escape_string()? Ken Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323822 Share on other sites More sharing options...
d22552000 Posted August 14, 2007 Author Share Posted August 14, 2007 ok im runnign word crawler now... crawl("SQL.PHP,REPLACE ALL WHERE \" WITH \\"); It's replacing... I'll upoad SQL.php if the site lets me upload 3.5mb files -,-. EDIT, replace finished, im running the program now.... EDIT, Page is loading... SQL.php is being parsed now... EDIT, Page Parsing complete, now its inserting the SQL... EDIT, 64912 files copied... Moving on to SQL... Parse error: syntax error, unexpected ';' in C:\Inetpub\wwwroot\VB3.6.7\sql.php on line 13218 CURRENT SOURCE: PHP FILE WITHOUT SQL: <?PHP function sql($DB) { $g_link = mysql_connect( '127.0.0.1', 'root', '') or die('Could not connect to server.' ); mysql_select_db($DB, $g_link) or die('Could not select database.'); $sql = " "; mysql_query($sql, $g_link) or die('Could not perform SQL.' . mysql_error();echo 'End of SQL.'; mysql_close($g_link); } ?> the full file can be found here: http://24.86.150.207/sql.php.txt The file is: 5,971 KBytes. oh and to the quotes, it was BY HAND!! I tried the file with double quotes now, escaping all $ and "... and I still got the same error. Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323835 Share on other sites More sharing options...
d22552000 Posted August 14, 2007 Author Share Posted August 14, 2007 cmon people, please? Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-323963 Share on other sites More sharing options...
lemmin Posted August 14, 2007 Share Posted August 14, 2007 Since you have one command executing that is over thirteen thousand lines, there is quite a bit of code someone would have to look through to find the syntax error. I am pretty sure what is happening is that there is a quotation mark that is closing the $sql string right in the middle. I would suggest using a program like Dreamweaver or Microsoft Word that allows you to search for a string and replace all occurances with another string. Use this feature to replace all occurances of """ with "\"". As long as you do that, there shouldn't be any php errors, cross your fingers for the sql part, though. Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-324000 Share on other sites More sharing options...
d22552000 Posted August 14, 2007 Author Share Posted August 14, 2007 that IS what I did, but for some reason it doesnt expect a ; somehwere near the end -,-. Uh... so... I wish there was another way to insert the sql, but I can't link sql files like you would a css file -,-,-,-,-. I originally did, uh.. fopen then fputs all the sql to a variable, but that had huge buffer problems, so I did this. IF YOU HAVE ANOTHER WAY PLEASE TELL ME. Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-324007 Share on other sites More sharing options...
d22552000 Posted August 15, 2007 Author Share Posted August 15, 2007 please? Quote Link to comment https://forums.phpfreaks.com/topic/64890-parse-error-syntax-error-unexpected-in-csqlphp-on-line-13218/#findComment-324142 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.