----- Original Message ----- 
From: "Chip Wiegand" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 17, 2004 12:29 PM
Subject: I can delete, add, but not update


> I don't know for sure, but I think I may have something wrong with
> permissions in MySQL. I have some web forms from which I can add new data
> and delete data. But when I try to do an update of existing data the data
> is not actually changed. Is it possible that the permissions are not set
> up correctly in MySQL?

Sure it's possible.

But it's also possible that your update statements are written incorrectly,
in such a way that they compile okay but don't actually touch the rows you
want to update. For example, if your UPDATE wants to give raises to the
people in department D21, this query won't do it:

update employees
set salary = salary * 2
where dept = 'D22'

[Please don't take offence: I'm not suggesting that you would miss anything
this obvious. I'm only trying to present a very simple example that
illustrates my point.]

It is also possible that your updates are written correctly but that no
qualifying rows are available to update. For example, if you correct the
UPDATE above but don't actually have any employees in department D21 at the
moment, the UPDATE will fail to change anything. [Again, you would probably
catch an error that obvious. However, the WHERE clause in your UPDATE could
be much more complex and it would be easy to mess it up in such a way that
it didn't hit the rows that you meant to update. All you'd need to do was
misspell a word or spell it with the wrong case, use 'NOT' in front of an
operator that was supposed to be positive, or whatever and you would have a
problem.]

Another possibility, somewhat less likely than the others, is that you are
looking at the rows that were supposed to be updated before they were
committed. In other words, if you do an update, and look at the result
before the COMMIT has taken place, you may be seeing the old version of the
data. Make sure that you have done the COMMIT before attempting to look at
the changed data.

By all means look at the syntax for the GRANT command in the MySQL manual
and make sure you have set the UPDATE privileges appropriately for your
table. Be sure to check out these other things if the GRANT command doesn't
appear to be the problem.

Rhino


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to