MySQL: is there a limit to the number of UPDATES?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
MySQL: is there a limit to the number of UPDATES?
Hi
This issue is driving me crazy. I am performing a simple UPDATE query. I need to know if there is a maximum about of "range = '$range', area = '$area'"..... fields that can be updated at once?
I ask this because I have just added one more field to be updated and it refuses to do it. If I remove one or more of these fields in the query, it works.
Many thanks in advance.
This issue is driving me crazy. I am performing a simple UPDATE query. I need to know if there is a maximum about of "range = '$range', area = '$area'"..... fields that can be updated at once?
I ask this because I have just added one more field to be updated and it refuses to do it. If I remove one or more of these fields in the query, it works.
Many thanks in advance.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: MySQL: is there a limit to the number of UPDATES?
There is no limit. There is probably an error in your query
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: MySQL: is there a limit to the number of UPDATES?
Thanks.
Odd really. If I remove ANY ONE item from the query, it works.
In full:
Odd really. If I remove ANY ONE item from the query, it works.
If I make itaccuracy = '$accuracy',
action = '$action',
rate = '$rate',
... it works. There are 31 variables in the statement, plus the $id for the 'WHERE'.accuracy = '$accuracy',
rate = '$rate',
In full:
$query = mysql_query ("UPDATE products SET
cat = '$cat',
subcat = '$subcat',
title = '$title',
description = '$description',
name = '$name',
replicaname = '$replicaname',
colour = '$colour',
construction = '$construction',
size = '$size',
weight = '$weight',
manufacturer = '$manufacturer',
ammo = '$ammo',
fps = '$fps',
actualfps = '$actualfps',
range = '$range',
accuracy = '$accuracy',
action = '$action',
rate = '$rate',
numbermagazines = '$numbermagazines',
magazine = '$magazine',
hopup = '$hopup',
accessories = '$accessories',
joules = '$joules',
glasses = '$glasses',
pellets = '$pellets',
offer = '$offer',
romancode = '$romancode',
best = '$best',
video = '$video',
price = '$price',
pricerrp = '$pricerrp'
WHERE id = '$id'");
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: MySQL: is there a limit to the number of UPDATES?
check the value of the result variable ($query in your case). Is it false? if so, what does mysql_error() returns?
Also, I don't see where those variables came from. They should be properly escaped or they could break the query. Those line breaks could possibly cause problems as well.
Also, I don't see where those variables came from. They should be properly escaped or they could break the query. Those line breaks could possibly cause problems as well.
Last edited by Eran on Tue May 25, 2010 11:48 am, edited 1 time in total.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: MySQL: is there a limit to the number of UPDATES?
The others are generally just Yes, No answers. Or presents from dropdowns.
How do I check the value of $query?
"Those link break could possibly cause problems as well."
What do you mean?
How do I check the value of $query?
"Those link break could possibly cause problems as well."
What do you mean?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: MySQL: is there a limit to the number of UPDATES?
Using the OR DIE process, I have found this:
[text]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 'range = '', accuracy = '', action = '', rate = '', numbermagazines = '',' at line 16[/text]
No idea where that is wrong though. Those fields are empty as nothing is being passed to them.
[text]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 'range = '', accuracy = '', action = '', rate = '', numbermagazines = '',' at line 16[/text]
No idea where that is wrong though. Those fields are empty as nothing is being passed to them.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: MySQL: is there a limit to the number of UPDATES?
Sorry, I meant line-breaks. The error indicates that there is something wrong just before the 'range' column in the query. Either the value before it is not escaped properly or the line-break is causing the issue"Those link break could possibly cause problems as well."
What do you mean?
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: MySQL: is there a limit to the number of UPDATES?
Sorry to sound dumb, but you do mean you think there is a <br/> in the query somewhere? ie, being passed in a variable? Because right before range is a field that just has numbers, but in fact is empty.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: MySQL: is there a limit to the number of UPDATES?
Do you see that there is a line between 'actualfps' and 'range'? that is a line break (the character equivalent would be \n or simply pressing enter in a text editor). Remove those line-breaksactualfps = '$actualfps',
range = '$range',
Re: MySQL: is there a limit to the number of UPDATES?
what pytrin said.... and in addition to that "range" is a reserver word in mysql 5.1 ... what mysql version are you using?
you can surround your field with ` like this
`range` = '$range'
and try
you can surround your field with ` like this
`range` = '$range'
and try
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: MySQL: is there a limit to the number of UPDATES?
Code: Select all
actual = '$actual',
'range' = '$range',
accuracy = '$accuracy',
action = '$action', Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: MySQL: is there a limit to the number of UPDATES?
because you are not using backticks
this:
is not the same than
this:
Code: Select all
'range' = '$range', Code: Select all
`range` = '$range'- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: MySQL: is there a limit to the number of UPDATES?
Backticks - `
Single quote - '
(p.s., you want to use backticks for quoting column/table names)
Single quote - '
(p.s., you want to use backticks for quoting column/table names)