elentz Posted February 16, 2010 Share Posted February 16, 2010 I have a select and an update query that work perfectly if I manually enter the record numbers for cf_565, and id. The fields get updated as they should. as soon as I try to use the variables $cf_565 and $id it fails. I get no error messages. Here is my code $result15 = mysql_query("SELECT vtiger_crmentity.description, vtiger_troubletickets.solution, vtiger_troubletickets.ticketid FROM vtiger_troubletickets Inner Join vtiger_crmentity ON vtiger_troubletickets.ticketid = vtiger_crmentity.crmid WHERE vtiger_troubletickets.ticketid = $cf_565"); $row = mysql_fetch_array($result15); $trouble= $row['description']; $fix =$row['solution']; $sql = "Update communiq_vtcrm1.vtiger_invoice x, communiq_vtcrm1.vtiger_crmentity z Set x.terms_conditions= '$fix' , z.description='$trouble' Where z.crmid = $id and x.invoiceid = $id"; $result = mysql_query($sql); I would also like to use an IF statement to ignore the above code and continue using another variable such as $cf_581 which is a checkbox and it would be true with a 1 Thanks for suggestions where I am going wrong Quote Link to comment https://forums.phpfreaks.com/topic/192307-need-help-with-variables-in-query/ Share on other sites More sharing options...
fenway Posted February 23, 2010 Share Posted February 23, 2010 Other than the fact that you're not quoting (or santizing, for that matter) your input value, it's hard to say without seeing the actual sql statements and errors. Quote Link to comment https://forums.phpfreaks.com/topic/192307-need-help-with-variables-in-query/#findComment-1016912 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.