it
mysql_query('SELECT * FROM mytable WHERE id < ' . mysql_real_escape_string($id));
it will be bad practice. If you want this to be a string, at least quote the string:
mysql_query('SELECT * FROM `mytable` WHERE `id`<"'.mysql_real_escape_string($id)).'"';
(and while you are specifying all the field and table names on it, since things like id can or will become reserved keywords at some point)
I would prefer a cast if it is a whole. One argument for the string version will be that on some day the identifier can be alphanumeric (as is increasingly seen on many websites).
source share