I am trying to learn how to use variables in MySQL:
$query = "
SET @myid = '1234';
SELECT * FROM `table1` WHERE `id` = @myid;
";
But I get a syntax error on line 1.
- I have looked at the manual and it states this is the correct syntax.
- I have also scoured stack but most of the questions are based on store procedures.
Are MySQL variables limited to stored procedures only? If not what am I doing wrong?