| Welcome to WebmasterWorld Guest from 22.214.171.124 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|validating form input|
need to validate apostrophe
I am having an issue where if there is an apostrophe in a field, the data is not being accepted into the database and errs out.
insert into database
$insert=mysql_query("INSERT INTO $tablename values (\"\", '$field1', '$field2', '$field3', '$field4')")
Any help appreciated.
is it field1 that is giving the error? what is the exact error?
I do find it much easier when I build my queries separate from the mysql_query call, like so
$q = "INSERT INTO $tablename values ('', '$field1', '$field2', '$field3', '$field4')";
$insert = mysql_query($q);
then I can echo the exact thing I am sending and paste that into the command line or phpmyadmin, or whatever you use for mysql, and look at the precise error.
you also should use only single quotes inside your qeury and double around, makes things easier
Thanks, the double/single worked.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved