Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Update problem

  1. #1
    mwm
    mwm is offline
    Regular Coder
    Join Date
    Oct 2005
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update problem

    Using the code below I want to change the date to the current date if the post variable is equal to Prospect, but the date is changed to the current date no matter what is in the post variable. Is there something wrong with the code that I don't see?


    if ($_POST['status'] = 'Prospect') {


    $query = ("UPDATE cust Set status = '$status', regdate = curdate() WHERE id = '$id'");

    $result = mysql_query($query) or die ("Could not Update");

    }
    else {

    $query = ("UPDATE cust Set status = '$status' WHERE id = '$id'");

    $result = mysql_query($query) or die ("Could not Update");
    }

  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    change this:
    PHP Code:
    if ($_POST['status'] = 'Prospect') { 
    to this:
    PHP Code:
    if ($_POST['status'] == 'Prospect') { 

  • #3
    mwm
    mwm is offline
    Regular Coder
    Join Date
    Oct 2005
    Posts
    174
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks I'll give it a try


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •