473,748 Members | 7,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Field Number Limitation into MySQL

Is there a restriction to the number of fields you can work with in a
PHP to MySQL connection? I'd used as many as 15 quite a few times and
now I have a form with 34 fields and can't seem to get the info
inserted into the table even though I'm not getting any connection
errors, etc. Since my method is identical, I'm wondering if there's
some 'rule' I am unaware of. TIA
Dec 11 '05 #1
19 2146
cover wrote:
Is there a restriction to the number of fields you can work with in a
PHP to MySQL connection? I'd used as many as 15 quite a few times and
now I have a form with 34 fields and can't seem to get the info
inserted into the table even though I'm not getting any connection
errors, etc. Since my method is identical, I'm wondering if there's
some 'rule' I am unaware of. TIA


GET vs POST? See the thread titled "Memory Limit for for HTML pages??"

Dec 11 '05 #2
Mara Guida said the following on 11/12/2005 17:31:
cover wrote:
Is there a restriction to the number of fields you can work with in a
PHP to MySQL connection? I'd used as many as 15 quite a few times and
now I have a form with 34 fields and can't seem to get the info
inserted into the table even though I'm not getting any connection
errors, etc. Since my method is identical, I'm wondering if there's
some 'rule' I am unaware of. TIA


Just tried a 34-field insert; it worked fine.

What is your query string?



GET vs POST? See the thread titled "Memory Limit for for HTML pages??"


This is completely unrelated.

--
Oli
Dec 11 '05 #3
cover wrote:
Is there a restriction to the number of fields you can work with in a
PHP to MySQL connection? I'd used as many as 15 quite a few times and
now I have a form with 34 fields and can't seem to get the info
inserted into the table even though I'm not getting any connection
errors, etc. Since my method is identical, I'm wondering if there's
some 'rule' I am unaware of. TIA

Put - echo mysql_error(); - right after your query.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*************** **************
Dec 11 '05 #4
cover wrote:
Is there a restriction to the number of fields you can work with in a
PHP to MySQL connection?


Do you mean a limit to the number of columns that a table can contain in
MySQL?

http://www-css.fnal.gov/dsg/external...-vs-pgsql.html

| MySQL: Maximum number of columns in one table - 3398

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Dec 11 '05 #5
On Sun, 11 Dec 2005 18:15:52 GMT, Oli Filth <ca***@olifilth .co.uk>
wrote:

Just tried a 34-field insert; it worked fine.
Hmmm. Guess I'll keep looking for an error.

What is your query string?


$sqlquery = "INSERT INTO $table VALUES('$id', '$etype', '$area',
'$equipname', '$jdeno', '$equipno', '$mccloc', '$bspec', '$bsize',
'$bfpm', '$gbmanu', '$lube', '$gbsize', '$gbratio', '$motorsize',
'$motorframe', '$drivesprocket ', '$drivensprocke t', '$chainsize',
'$lacingtype', '$brgtypesize', '$brgqty', '$tbrgtypesize' , '$tbrgqty',
'$headsize', '$hoawidth', '$tailsize', '$toawidth', '$cbsize',
'$keysize' '$uhmwsize', '$convnotes',)" ;

$results = mysql_query($sq lquery);
Dec 11 '05 #6
On Sun, 11 Dec 2005 12:11:02 -0700, Chuck Anderson
<we************ @seemy.sig> wrote:

Put - echo mysql_error(); - right after your query.


Thanks, I inserted it as follows:
$results = mysql_query($sq lquery);
echo mysql_error();
mysql_close();

and received the following error :
"Column count doesn't match value count at row 1"

looked at the database again and field lengths were okay to accomodate
variable content - thoughts?
Dec 11 '05 #7
cover wrote:
On Sun, 11 Dec 2005 18:15:52 GMT, Oli Filth <ca***@olifilth .co.uk>
wrote:

Just tried a 34-field insert; it worked fine.


Hmmm. Guess I'll keep looking for an error.

What is your query string?


$sqlquery = "INSERT INTO $table VALUES('$id', '$etype', '$area',
'$equipname', '$jdeno', '$equipno', '$mccloc', '$bspec', '$bsize',
'$bfpm', '$gbmanu', '$lube', '$gbsize', '$gbratio', '$motorsize',
'$motorframe', '$drivesprocket ', '$drivensprocke t', '$chainsize',
'$lacingtype', '$brgtypesize', '$brgqty', '$tbrgtypesize' , '$tbrgqty',
'$headsize', '$hoawidth', '$tailsize', '$toawidth', '$cbsize',
'$keysize' '$uhmwsize', '$convnotes',)" ;


There's a comma before the closing bracket. I would say that's your
error. echo mysql_error() after running the query and see what happens.
Or alternatively echo out the sql string and paste it into the mysql
console or phpMyAdmin etc.

One other thing, where do all those values come from? Directly from the
form with no escaping? If so, you need to read up on the topic of sql
injection.

And one other thing... I personally believe you are better to write your
insert query in the form:

INSERT INTO tablename (fieldname1, fieldname2, ... ) VALUES ('value1',
'value2', ...)

than not specity the fieldnames. Sure, it takes time to write your
query, but if you add a column to the table at a later time you will
break any existing insert queries for that table as the number of
columns specified in your query won't match the number in the table.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Dec 11 '05 #8
cover wrote:
On Sun, 11 Dec 2005 12:11:02 -0700, Chuck Anderson
<we************ @seemy.sig> wrote:

Put - echo mysql_error(); - right after your query.


Thanks, I inserted it as follows:
$results = mysql_query($sq lquery);
echo mysql_error();
mysql_close();

and received the following error :
"Column count doesn't match value count at row 1"

looked at the database again and field lengths were okay to accomodate
variable content - thoughts?


It means you have eg 35 columns in your database but your sql string
only has values for 34 of them. See the other message I just posted a
couple of minutes ago.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Dec 11 '05 #9
On Mon, 12 Dec 2005 10:20:59 +1300, Chris Hope
<bl*******@elec trictoolbox.com > wrote:

There's a comma before the closing bracket. I would say that's your
error. echo mysql_error() after running the query and see what happens.
Or alternatively echo out the sql string and paste it into the mysql
console or phpMyAdmin etc.
caught the comma after installing the echo mysql_error(); line and now
have:
"You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'x 2" x .25', 'no notes')' at line 1" unless I remove the
measurements from the uhmwsize field which were 60' x 2" x .25"*

after blanking that field, the error came back to a more simple
"Column count doesn't match value count at row 1" which now makes me
wonder... Setting id as an integer when establishing the database,
what numerical entry should I enter into that?
One other thing, where do all those values come from? Directly from the
form with no escaping? If so, you need to read up on the topic of sql
injection.
I use two forms to enter the data and until now, it's worked very well
(so far with fields of 12 or less). One form is the user input, the
second does the query and insert while echoing the values to the
screen of what the user just entered into the database.
And one other thing... I personally believe you are better to write your
insert query in the form:

INSERT INTO tablename (fieldname1, fieldname2, ... ) VALUES ('value1',
'value2', ...)
I've done it this way too - kind of got away from it which may have
been bad however, went back to it for this error solving and it made
no difference in the outcome or error.

than not specity the fieldnames. Sure, it takes time to write your
query, but if you add a column to the table at a later time you will
break any existing insert queries for that table as the number of
columns specified in your query won't match the number in the table.

Dec 12 '05 #10

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

Similar topics

11
3136
by: abs | last post by:
Input field of the form. How to check which number this field has ? I mean the order number, like variable elementNumber in document.forms.elements ? Is it possible to check without looping and comparing some attributes in every loop ? Best regards, ABS
1
1552
by: Larry | last post by:
There is a font number limitation in Access which prevents them from appearing on some pop-up lists. Has anybody encountered this same problem and if so is there some work-around. I do a lot of web publishing and I do not want to remove fonts from my Font directory just because of Access.
39
3223
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
4
3053
by: Chris Tate-Davies | last post by:
Hello. I have a generic table used for many different generic functions. the fields are mainly varchar's but one of these varchars contains dates (in the format dd/mm/yyyy) for one reason or another. My question is, can I perform a query on this table, using date functions on this varchar field? I.e. search for the latest date? Thanks, Chris
1
1416
by: Xaysana12345 | last post by:
Hi there, Please help, I'm absolutely stuck. I want to do MsgBox whenever number in subformfield greater than the number in mainform field or other way around, I want to happen a message says "You can't spend over your budget" then SetFocus. Please advise. Thank you
3
1546
juve11
by: juve11 | last post by:
hello, i have a vb application that writes into mysql (some kind of autocomplete). problem is that it writes too many rows and the app at a moment starts to run slowly.so an option that i thaught about is that to limit number of rows that can be written in mysql, i just dont know if that is possible? thank you!
1
1486
by: cypherinfo | last post by:
Hello, I'm a newbye here and about PHP; be patient please :-) I have a mySQL table with 15000 rows; I need to populate a field of it (varchar(15)) - to be used in a way similar to a primary key - with the uniqid() PHP function. The algorithm is: 1 - positioning to the first row (record); 2 - generating a value with the uniqid() function; 3 - updating with it an empty field of that record;
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9544
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...
1
9324
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
8243
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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
6074
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
4606
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...
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.