Jump to content

Need help with variables in Query


elentz

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/192307-need-help-with-variables-in-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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