-1

I am new to php and trying below code, value is inserting but it is not updating and not giving me any error or warming. I want when I am updating as "HOT" entire value in table based on "lead_id" should be updated to "HOT".

    if ($status=="OK") 
    { 
        $query=mysqli_query($con,"insert into lead_comments(lead_id,emp_id,lead_status,comments) values('$lead_id','$emp_id','$lead_status','$comments')");

        if ($lead_status == 'HOT'){
            $query_update_hot=mysqli_query($con,"update lead_comments set lead_status='$lead_status' where lead_id='lead_id' and emp_id = '$emp_id'");
        }
        if ($lead_status == 'WARM'){
            $query_update_warm=mysqli_query($con,"update lead_comments set lead_status='$lead_status' where lead_id='lead_id' emp_id = '$emp_id' ");
        }
        if ($lead_status == 'COLD'){
            $query_update_cold=mysqli_query($con,"update lead_comments set lead_status='$lead_status' where lead_id='lead_id' emp_id = '$emp_id' ");
        }

        print "
                <script language='javascript'>
                    window.location = 'thankyou.php?username=$admin';
                </script>
            "; 
    }
}
Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49
  • Have you enabled error log? https://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php – Tuan Duong Sep 18 '17 at 06:12
  • As the answer says your update queries is missing the `$` where you assign your `lead_id`. Just correct that and code will work. – S4NDM4N Sep 18 '17 at 06:19

1 Answers1

0

Change the lead_id into variable name . you are missing the $ for lead_id

 $query_update_hot=mysqli_query($con,"update lead_comments set lead_status='$lead_status' where lead_id='lead_id' and emp_id = '$emp_id'");

use the following query

   $query_update_hot=mysqli_query($con,"update lead_comments set lead_status='$lead_status' where lead_id='$lead_id' and emp_id = '$emp_id'");
Arun Vitto
  • 163
  • 10