TRI0N Posted April 14, 2008 Share Posted April 14, 2008 Okay tried to search on this but how do I deal with Hyphen or Quotes in input fields? Right now if I put in Event: Mike's Party It will cause data entry problem. Quote Link to comment Share on other sites More sharing options...
gluck Posted April 14, 2008 Share Posted April 14, 2008 use this mysql_real_escape_string() Quote Link to comment Share on other sites More sharing options...
TRI0N Posted April 15, 2008 Author Share Posted April 15, 2008 So I'm taking that the following will work then? mysql_query("INSERT INTO clients VALUES('NULL','$client_id','$l_name','$f_name','mysql_real_escape_string($event_name)')") OR die(mysql_error()); This will allow the correct input of a form for Event Name to be placed into the MySQL data field with the value of: Mike's Party Rather then: Mike MySQL Error? Thanks I will give it a shot. Quote Link to comment Share on other sites More sharing options...
atl_andy Posted April 15, 2008 Share Posted April 15, 2008 I think you'll need to read up on the syntax of mysql_real_escape_string. It's what you need, but not how you have it. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 15, 2008 Share Posted April 15, 2008 So I'm taking that the following will work then? mysql_query("INSERT INTO clients VALUES('NULL','$client_id','$l_name','$f_name','mysql_real_escape_string($event_name)')") OR die(mysql_error()); This will allow the correct input of a form for Event Name to be placed into the MySQL data field with the value of: Mike's Party Rather then: Mike MySQL Error? Thanks I will give it a shot. It's a PHP function... you can't pass it to mysql. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.