Alien Posted October 31, 2003 Share Posted October 31, 2003 I have a 5000-character-long query. I saved it in a textfile and sent it successfully in this way: mysql> source myquery.txt However, when I passed the query to the server in a php script, not the whole query was sent; only part of it was sent. How can I fix it? Quote Link to comment Share on other sites More sharing options...
shivabharat Posted October 31, 2003 Share Posted October 31, 2003 Read this http://www.mysql.com/doc/en/Batch_mode.html If you are running mysql under Windows and have some special characters in the file that cause problems, you can do this: dos> mysql -e \"source batch-file\" Quote Link to comment Share on other sites More sharing options...
Alien Posted October 31, 2003 Author Share Posted October 31, 2003 Read this http://www.mysql.com/doc/en/Batch_mode.html If you are running mysql under Windows and have some special characters in the file that cause problems, you can do this: dos> mysql -e \"source batch-file\" hmm...it is the same as what I post \"source filename\". what can I do if I want to use a php script? Quote Link to comment Share on other sites More sharing options...
shivabharat Posted October 31, 2003 Share Posted October 31, 2003 You may try like this Ensure that the whole query is in a single line . <? $contents = file("sql.txt"); while (list($qry) = each($contents)) { echo $contents[$qry]; } ?> Quote Link to comment Share on other sites More sharing options...
Alien Posted November 3, 2003 Author Share Posted November 3, 2003 I think that u mis-understand my question.... I only have one query, which is a select statment. But the select statement is too long, it contains about 6000 characters, so it can\'t pass through... Quote Link to comment 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.