I am trying to get the value of a count into into a variable to be used with another query.
BUT it does not work, it says:
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(columnname) FROM field WHERE tabid = 4' at line 1
The query I am using is:
SET @_count = SELECT COUNT(columnname) FROM field WHERE tabid = 4;
You're going to need to wrap the SQL Select Query in parenthesis.
SET @_count = (SELECT COUNT(columnname) FROM field WHERE tabid = 4);