It's always wise to use mysql_real_escape_string() when inserting data to the database. It's much more secure than addslashes(). For numeric values you should use intval(), though.
Take a look at the manual page for more info:
www.php.net/mysql_real_escape_string
Maybe you want to look at the user comments too, for more info and tips.