I get the error message:
#1054 - Unknown column 'kaseamgc_store.plans.plan_id' in 'where clause'
This message is coming from my trigger which is a before insert trigger. It runs the following SQL:
UPDATE kaseamgc_store.store_players
SET credits = credits + kaseamgc_store.plans.creditvalue
WHERE kaseamgc_store.plans.plan_id = kaseamgc_store.orders.plan_id
AND kaseamgc_store.store_players.authid LIKE '%kaseamgc_store.orders.steam_id'
Now I ran the following SQL when I got the message (probably irrelevant):
INSERT INTO finish_order (txn_id, payer_email, mc_gross, steam_id, username,
password, date, provider, plan_id, forum_userid)
VALUES ('info', 'email-adress', '1.00', 'STEAM_ID', 'TheUsername',
'no-pass', 20150416, 'paypal', 1, 0)
I have removed some of the info, but it's irrelevant. Anyhow here's some screenshots of how the column plans.plan_id
looks like in phpmyadmin:
I have 4 rows so I should have 1-4 in plans.plan_id
Edit: So i seem to be having this problem all over. I know it has something to do with the lines, but no idea why it's happening. It's where i want to compare two *variables. Any thoughts?
You are updating table kaseamgc_store.store_players
and expect a column of table kaseamgc_store.plans
(plan_id
).
UPDATE kaseamgc_store.store_players -- table store_players
SET ...
WHERE kaseamgc_store.plans.plan_id .... -- table plans
That won't work. The correct solution depends on what you exactly need. A preceding assignment to a local variable might be a solution.