sudsy1970 Posted November 16, 2008 Share Posted November 16, 2008 hi there, I am using a form to submit first name, surname, username etc which i upload to a database. Now i know that sql will throw a wobbly if i entered o'callaghan and that i would need to enter something like: insert into users (surname) values ('O''Callaghan') However how can i recognise that the surname has an apostrophe from the form and then correct it if the code section above how it should be entered. the code for the form is simply $Surname = $_POST['Surname']; Also i can redirect back to the form if i find any errors in it using header() but how can i put a message to let people know why this has happened. i.e the passwords you supplied do not match, username name already in use etc. Thanks for any suggestions Link to comment https://forums.phpfreaks.com/topic/132973-irish-names-in-sql/ Share on other sites More sharing options...
Mchl Posted November 16, 2008 Share Posted November 16, 2008 Use proper escaping function. For mysql it's mysql_real_escape_string Link to comment https://forums.phpfreaks.com/topic/132973-irish-names-in-sql/#findComment-691501 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.