Page 1 of 1

MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 10:54 am
by simonmlewis
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.

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 10:58 am
by Eran
There is no limit. There is probably an error in your query

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:09 am
by simonmlewis
Thanks.
Odd really. If I remove ANY ONE item from the query, it works.
accuracy = '$accuracy',
action = '$action',
rate = '$rate',
If I make it
accuracy = '$accuracy',
rate = '$rate',
... it works. There are 31 variables in the statement, plus the $id for the 'WHERE'.

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'");

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:14 am
by Eran
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.

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:21 am
by simonmlewis
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?

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:26 am
by simonmlewis
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.

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:50 am
by Eran
"Those link break could possibly cause problems as well."
What do you mean?
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

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:53 am
by simonmlewis
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.

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 11:56 am
by Eran
actualfps = '$actualfps',

range = '$range',
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-breaks

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 12:07 pm
by mikosiko
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

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 12:20 pm
by simonmlewis

Code: Select all

actual = '$actual', 
'range' = '$range', 
accuracy = '$accuracy', 
action = '$action', 
This doesn't work either and has the same error.

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 12:24 pm
by mikosiko
because you are not using backticks

this:

Code: Select all

'range' = '$range', 
is not the same than

Code: Select all

`range` = '$range'

Re: MySQL: is there a limit to the number of UPDATES?

Posted: Tue May 25, 2010 12:26 pm
by John Cartwright
Backticks - `
Single quote - '

(p.s., you want to use backticks for quoting column/table names)