473,499 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maximum length of MySQL query?

Does anyone know if there's an upper limit to the length of the query
string supplied to the mysql_query() function? It appears that strings
themselves can go well beyond 65,536 characters: the PHP manual does not
seem to specify the upper limit, but in one test I was able to construct
a 1,000,960 character string without a hitch.

The queries my code will construct will be considerable smaller --
between 3,500 characters and roughly 20,000 characters. Can anyone tell
me if a 20,000-character UPDATE will cause problems, given the code
below and assuming that the $updateSQL string contains valid MySQL code:

$database_VoIP_Connection = ...;
$VoIP_Connection = ...;
$updateSQL = "UPDATE ... SET ... WHERE ...";
mysql_select_db($database_VoIP_Connection, $VoIP_Connection);
$Result1 = mysql_query($updateSQL, $VoIP_Connection) or
die(mysql_error());

I can chop up the query into smaller pieces if need be, but I'd rather
execute a single UPDATE for speed and simplicity.
-- Bert Sierra
Tempered MicroDesigns
Prescott, AZ
Jul 17 '05 #1
1 28731
py
Bert Sierra wrote:
Does anyone know if there's an upper limit to the length of the query
string supplied to the mysql_query() function? It appears that strings
themselves can go well beyond 65,536 characters: the PHP manual does not
seem to specify the upper limit, but in one test I was able to construct
a 1,000,960 character string without a hitch.

The queries my code will construct will be considerable smaller --
between 3,500 characters and roughly 20,000 characters. Can anyone tell
me if a 20,000-character UPDATE will cause problems, given the code
below and assuming that the $updateSQL string contains valid MySQL code:

$database_VoIP_Connection = ...;
$VoIP_Connection = ...;
$updateSQL = "UPDATE ... SET ... WHERE ...";
mysql_select_db($database_VoIP_Connection, $VoIP_Connection);
$Result1 = mysql_query($updateSQL, $VoIP_Connection) or
die(mysql_error());

I can chop up the query into smaller pieces if need be, but I'd rather
execute a single UPDATE for speed and simplicity.
-- Bert Sierra
Tempered MicroDesigns
Prescott, AZ


20,000-character should work fine with mysql > 4

Look here for more info:
http://www.devshed.com/c/a/MySQL/Tro...QL-Programs/4/

py
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5376
by: joemyre | last post by:
Hi everyone, What I'm trying to do is take php variables i got from user input, and pass them as the MySQL query terms. $query = "select * from ident where ".$searchtype1."=".$searchterm1."";...
0
2323
by: Murphy | last post by:
I am currently migrating a db from SQL Server & MySQL and ? (front end yet to be decided upon) As I familiarise myself with MySQL populating tables etc can be quite clumbersome. After reading the...
0
5013
by: Stuart E. Wugalter | last post by:
Hello: I have a form (record source: tblMasterTable) containing a MEMO field named "FASTA." I have used a double-click event to trigger a macro that runs the following query: SELECT SNPID,...
0
2204
by: taras.di | last post by:
Hi everyone, I've come across an extremely strange problem. The exact same query in both mysql command line client, and mysql query browser gives entirely different results. I was hoping someone...
1
9818
by: Alan Foxmore | last post by:
Hello all, Is it possible to use String.Format() to specify a maximum length for a formatted item? For example, let's say I have: String.Format("{0}", "FREDDY"); How can I specify that the...
3
21979
by: hug | last post by:
The valid character set for the ID= attribute of html tags is listed here (http://www.htmlhelp.com/reference/html40/attrs.html) but I am having difficulty finding the maximum allowable length of...
7
64786
by: Martin Pöpping | last post by:
Hello, does a String in C# have a maximum length? I tried to write a ToString Method of my class containing a hashtable. At the beginning of the method i defined a String "ret". In every...
2
3379
by: Paul Johnston | last post by:
I know this may sound silly but given something like if ($_ =~m/(one)|(two)|(three)/) Is there a maximum length on the size of the item between "/" and" /" ? Just curious as regards showing...
10
2630
by: Lloyd Harold | last post by:
I'm very new to PHP and attempting to put together a simple script for retrieving MySQL data of personal records. The MySQL table I'm using consists of: 0: id 1: name 2: location (an integer...
0
1648
by: Ramu528 | last post by:
Friends, I am working on excel sheet. i populated gridview with excel sheet data. the gridview has one column. have to find out the maximum length of String in that column. For example:...
0
7169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4917
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.