So you would like to check the quantity that the user has entered versus the available stock when they are trying to add it to the cart correct?
If you are trying to compare the posted value against a column in your table then you would need to do it within the advanced recordset creation view. In here you would be able to craft the query just like the sample that you noted, but where you are using the value from the form you should just enter a name for this value, then in the bottom you will need to define the query parameter. Click on add and set the name to the name you used in the sql, then for the value you can enter $_POST['<quantity field>'] as the runtime value, for the default value you should use something that will never work out, like 0.
Please post back and let me know if this is the way you are trying to do it and if this will work for you or if you have other requirements. Please post back with the details.