When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website.
I usually just have a function escape_string(blah),
You're better off using prepared statements with placeholders. Are you using PHP, .NET...either way, prepared statements will provide more security, but I could provide a sample.