Jump to content

won't update


jeff5656

Recommended Posts

When i try to update a record, it does not get updated.

 

$qq = "update dos set completed = 'rejected', rejectreason='$rejectreason' where dos_id = '$dosid' LIMIT 1";
mysql_query($qq) or die(mysql_error());

 

the field that is called  "completed" is an enum:

CREATE TABLE IF NOT EXISTS `dos` (

  `dos_id` int(254) NOT NULL AUTO_INCREMENT,

  [...]

  `completed` enum('n','y','rejected') NOT NULL,

etc.

 

So when I try to change the "completed" field to "rejected" it does not update but when i update it to either an "n" or a "y" it works.

 

Does anyone see any problems?  It's weird.  I can also manually change it to "rejected" within phpmyadmin.

 

Also when I echo $qq, the dos_id (and $dosid) is correct, but that record is not being updated.  That record still has a "n" instead of "rejected".

Link to comment
https://forums.phpfreaks.com/topic/265437-wont-update/
Share on other sites

Ok I feel really stupid about this especially with everyone chiming in to help.

That update statement was up at top of the page under an if (isset(_post).

 

right below that was another IF line that was true, containing a query to update completed to n!!  So it WAS updating to "rejected" and then a second query 4 lines down was updating it to "n"! 

Sorry to waste everyone's time LOL!

 

 

Link to comment
https://forums.phpfreaks.com/topic/265437-wont-update/#findComment-1360311
Share on other sites

try with no '<<< acts like a LIKE then see what happens?

$qq = "update dos set completed = rejected, rejectreason='$rejectreason' where dos_id = '$dosid' LIMIT 1";
mysql_query($qq) or die(mysql_error());

 

What are you talking about? Removing the quotes from 'rejected' will attempt to set the `completed` field to the value of the `rejected` field if one exists, and has nothing to do with a LIKE comparison.

Link to comment
https://forums.phpfreaks.com/topic/265437-wont-update/#findComment-1360312
Share on other sites

try with no '<<< acts like a LIKE then see what happens?

$qq = "update dos set completed = rejected, rejectreason='$rejectreason' where dos_id = '$dosid' LIMIT 1";
mysql_query($qq) or die(mysql_error());

 

 

ok what ever.

 

What are you talking about? Removing the quotes from 'rejected' will attempt to set the `completed` field to the value of the `rejected` field if one exists, and has nothing to do with a LIKE comparison.

Link to comment
https://forums.phpfreaks.com/topic/265437-wont-update/#findComment-1360318
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.