PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
this code is supposed to update a dataset.
my problem is, that the VAT value is allready in the dataset that i want to change (red).
i dont know how to get it out for the SWITCH or hot to write the command.!)!
<?php
error_reporting(E_ALL);
if($_POST['exrate']>0){
switch ([color=red]VAT[/color]){
case J:
$sql = "UPDATE sam_date_val SET tovalue=toamount*'" .$_POST['exrate']."'*'1.16'+amendment1+amendment2+amendment3 WHERE (projnr='$projnr' AND customernr='$customernr' AND contrdate='$contrdate')";
mysql_query ($sql) or die ( 'MySQL-Fehler: ' . mysql_error ());
case N:
$sql = "UPDATE sam_date_val SET tovalue=toamount*'" .$_POST['exrate']."'+amendment1+amendment2+amendment3 WHERE (projnr='$projnr' AND customernr='$customernr' AND contrdate='$contrdate')";
mysql_query ($sql) or die ( 'MySQL-Fehler: ' . mysql_error ());
}
}
?>
okey - i try to explain again ...
there is a dataset that will be updated by this code (tovalue=.....)
but but how it will be updated depends on the VAT, that is already saved IN the dataset that will be saved.
so VAT is not entered in the same form .... it is in the same dataset that i want to change - so switch(VAT)
will not be working i have to read out VAT from the dataset that will be chnaged.
Like switch(VAT from ... where ...) ... i hope you got it this time!!!
$result = mysql_query(
"SELECT `VAT` FROM `sam_date_val` WHERE (projnr='$projnr' AND customernr='$customernr' AND contrdate='$contrdate'";
);
$row = mysql_fetch_assoc($result);
switch ($row['VAT']){
case 'J':
I'm still not sure as to what VAT will be returning. I am assuming it returning 'J' or 'N', but I cannot be sure.