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 19 2143
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??"
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
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.
*************** **************
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);
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?
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
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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
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.
|
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
|
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
|
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
| |
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!
|
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;
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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...
|
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...
| |
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |