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? Link to comment https://forums.phpfreaks.com/topic/1261-query-is-too-longcant-send/ 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\" Link to comment https://forums.phpfreaks.com/topic/1261-query-is-too-longcant-send/#findComment-4197 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? Link to comment https://forums.phpfreaks.com/topic/1261-query-is-too-longcant-send/#findComment-4198 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]; } ?> Link to comment https://forums.phpfreaks.com/topic/1261-query-is-too-longcant-send/#findComment-4200 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... Link to comment https://forums.phpfreaks.com/topic/1261-query-is-too-longcant-send/#findComment-4252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.