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
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());

 

echo out the input see what happening.

 

echo $qq;

 

 

Link to comment
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.