mysql_query("INSERT INTO withdraw (username,amount,date) SELECT username,amount,NOW() FROM accounts WHERE username='$username' UPDATE accounts SET amount =0 WHERE username = '$user'")
i want to update data after insert but this query not working
mysql_query("INSERT INTO withdraw (username,amount,date) SELECT username,amount,NOW() FROM accounts WHERE username='$username' UPDATE accounts SET amount =0 WHERE username = '$user'")
i want to update data after insert but this query not working
Just put all the columns you need to insert in the select-part
INSERT INTO withdraw (username, amount, some_date)
SELECT username, amount, now()
FROM accounts
WHERE username='$username';