I am trying to use if statement on "insert into table values" statement under PHP environment and use $_post[] as a variable to make a complex SQL query for the field updating. The script is under below. It is mainly about updating the field which is with NULL into empty string. Seems not working for me. can anybody help me out?
$strSQL = "INSERT INTO SR ";
$strSQL .="(DESC,ATTACH) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtDesc"]."','".((SELECT $_POST["txtAttach"] FROM SR WHERE $_POST["txtAttach"] is NULL)," ")."')";