Jump to content

Can some one show me what I have wrong??


elentz

Recommended Posts

Given the code below, I need to run the queries according to the IF statement.  Can some one show me how to do this??

Thanks alot!

 

$taxablequote = "SELECT

`vtiger_quotes`.`quoteid`,

`vtiger_accountscf`.`cf_455`

FROM

`vtiger_quotes`

Inner Join `vtiger_account` ON `vtiger_quotes`.`accountid` = `vtiger_account`.`accountid`

Inner Join `vtiger_accountscf` ON `vtiger_accountscf`.`accountid` = `vtiger_account`.`accountid`

WHERE

`vtiger_quotes`.`quoteid` =  '$record'";

$RESULT = MYSQL_QUERY($taxablequote,$conn);

 

if (cf_455 = 1) {

$quotetaxable = "update vtiger_quotes set salestax = subtotal * .06 Where quoteid = $record";

$result = mysql_query($quotetaxable,$conn)}

else

{$quotenontaxable = "update vtiger_quotes set salestax = "0.00" where quoteid = $record";

$result = mysql_query($quotenontaxable,$conn)};

 

$grandtotal = "update vtiger_quotes set total = subtotal + s_h_amount + salestax - adjustment";

$result = mysql_query($grandtotal,$conn);

 

Link to comment
https://forums.phpfreaks.com/topic/62268-can-some-one-show-me-what-i-have-wrong/
Share on other sites

"didn't work" doesn't help.

 

If $cf_455 is a defined value it should work with the comparison operator == (as Barand posted).

 

On the other hand, if $cf_455 is taken from a database, you need to abstract it from the query result before using it.

Sorry about the doesn't work.  If I comment out the If / Else statements my page loads just fine (without doing what I want). I think you might have something there about abstracting the cf_455.  I tried to echo it to the screen without the if/Else and I got nothing, other than what I got with all the if/else commented out.  I'll see what I can do to extract it.  If I am right I should be OK if/when I can echo it to the screen along with the page itself.

 

Thanks

The very first query is where cf_455 comes from.  Although I can't get it to even echo on the page.  If I run that query in phpmyadmin I get either a 1 or 0 result depending on the quoteid I use.  The quoteid is in a session that is used elsewhere on the page in other queries down the page from this one.  So I think I might not be getting the cf_455 info and that might be why it is failing.

 

Thanks

Well, I think I have the problem identified.  I believe I am not getting the value of cf_455.  So I have changed my query to only get the field cf_455.  I can't seem to get the output of that query.  Here is what I have not:

 

$sql = 'SELECT '

        . ' `vtiger_accountscf` . `cf_455` '

        . ' FROM '

        . ' `vtiger_quotes` '

        . ' Inner Join `vtiger_account` ON `vtiger_quotes` . `accountid` = `vtiger_account` . `accountid` '

        . ' Inner Join `vtiger_accountscf` ON `vtiger_accountscf` . `accountid` = `vtiger_account` . `accountid` '

        . ' WHERE '

        . ' `vtiger_quotes` . `quoteid` = \ '16124\' LIMIT 0, 30;

$RESULT = MYSQL_QUERY($sql,$conn);

Print '$cf_455';

 

At this point if I could get the information onto the page I will be happy.  Then I need to get it to get the other queries to work.

Thanks for looking at my stuff!

 

Ed

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.