473,624 Members | 2,394 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_Connectio n = ...;
$updateSQL = "UPDATE ... SET ... WHERE ...";
mysql_select_db ($database_VoIP _Connection, $VoIP_Connectio n);
$Result1 = mysql_query($up dateSQL, $VoIP_Connectio n) 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 28828
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_Connectio n = ...;
$updateSQL = "UPDATE ... SET ... WHERE ...";
mysql_select_db ($database_VoIP _Connection, $VoIP_Connectio n);
$Result1 = mysql_query($up dateSQL, $VoIP_Connectio n) 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
5388
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.""; ERROR: Invalid query: You have an error in your SQL syntax near '=' at line 1
0
2327
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 MySQL site it appears the "Query Browser" is the correct tool which I've downloaded, extracted and followed the instruction for installing it... without success, it doesn't work. To clarify what I've done I've: Downloaded:...
0
5028
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, OrderNum, RefNo, FASTA FROM tblMasterTable WHERE Forms!frmFASTA!FASTA=FASTA;
0
2212
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 out there could shed some light. Ok, the query (I've stripped it bare, the real query is a bit more complex)...
1
9872
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 result of the formatting should be a string no longer than, say, 3 characters? I know I can easily specify the minimum length, but I am producing a report with columns. I need to
3
22025
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 the id string. ? tia. -- http://www.ren-prod-inc.com/hug_soft/store.php?action=contact
7
64805
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 iteration of my hashtable I add the content with ret += "...". After some time my programm crashes.
2
3385
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 bad programming techniques. TIA Paul
10
2639
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 relating to a separate table of locations). 3: details
0
1666
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: gridviews has one column with three names Ram Murali Hari Krishna Murthy Sharma
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1487
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.