i am inserting into a table and want to update a field in another one, how can i add update statement into
$insertSQL = sprintf("INSERT INTO sellbuytable (AccountNo, StockSympol, TraDate, Sell, Buy, Price, Commition, Broker) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['AccountNo'], "text"),
GetSQLValueString($_POST['Symbol'], "text"),
GetSQLValueString($_POST['tradate'], "date"),
GetSQLValueString($_POST['sell'], "double"),
GetSQLValueString($_POST['buy'], "double"),
GetSQLValueString($_POST['Price'], "double"),
GetSQLValueString($_POST['commition'], "double"),
GetSQLValueString($_POST['broker'], "text"));
$insertSQL = sprintf("INSERT INTO sellbuytable (AccountNo, StockSympol, TraDate, Sell, Buy, Price, Commition, Broker) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['AccountNo'], "text"),
GetSQLValueString($_POST['Symbol'], "text"),
GetSQLValueString($_POST['tradate'], "date"),
GetSQLValueString($_POST['sell'], "double"),
GetSQLValueString($_POST['buy'], "double"),
GetSQLValueString($_POST['Price'], "double"),
GetSQLValueString($_POST['commition'], "double"),
GetSQLValueString($_POST['broker'], "text"));
$sql="INSERT INTO sellbuytable (AccountNo, StockSympol, etc) VALUES('$_POST[AccountNo]','$_POST['StockSymbol'],etc)";
$res=mysql_query($sql);
$sql2="UPDATE table SET whatever='whatever' WHERE whatever='whatever'";
$res2=mysql_query($sql2);
$res=mysql_query($sql);
$sql2="UPDATE table SET whatever='whatever' WHERE whatever='whatever'";
$res2=mysql_query($sql2);
da um isere รงรงรง csdfakjkjkjkwjer adsfaf fasdf gggeeartt
get de num sei o q ai
mais um do get ai
depois tu double ai
ai tu via no value!!
get de num sei o q ai
mais um do get ai
depois tu double ai
ai tu via no value!!
$sql="INSERT INTO sellbuytable (AccountNo, StockSympol, etc) VALUES('$_POST[AccountNo]','$_POST['StockSymbol'],etc)";
$res=mysql_query($sql);
$sql2="UPDATE table SET whatever='whatever' WHERE whatever='whatever'";
$res2=mysql_query($sql2);
$res=mysql_query($sql);
$sql2="UPDATE table SET whatever='whatever' WHERE whatever='whatever'";
$res2=mysql_query($sql2);
Rob, above has it, you don't have an UPDATE statement
You would probably be best off using MySQL Stored Procedures. They are very good at handling that type of thing. The more that you have handled within MySQL rather than in your code, the less resources your program is going
to require.
If you choose not to go that way, I would just fire off the two commands seperately. It's "clunkier" but, for the most part, will give the same result.
If you choose not to go that way, I would just fire off the two commands seperately. It's "clunkier" but, for the most part, will give the same result.