SET @numrows=5;
PREPARE STMT FROM 'SELECT * FROM tbl LIMIT ?';
EXECUTE STMT USING @numrows;
In this way you can solve your problem.
However if you go to
http://dev.mysql.com/doc/refman/5.1/en/select.html
you can try the same example and a good explanation.
Leave a comment: