Jump to content

Archived

This topic is now archived and is closed to further replies.

Alien

query is too long...can't send?

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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];

} 

?>

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.