hello everyone. I'm doing a php script that will read and write to my database and as you all know inputted data with apostrophe's gives an error whenever queried i was thinking on a way on how to filter the strings so that it would be able to accept apostrophe's.Anyone have ideas how to do it.Also i would like to know if i create a function in javascript will php be able to communicate with it?

Member Avatar for diafol

Apostrophes should be escaped, so they don't give an error.

When entering data use mysql_real_escape_string() on ALL data. This should obviate any problems on retrieval.

can this function also be used if i use ODBC? thanks for the reply

Member Avatar for diafol

I don't think it will work in ODBC. mysql_* functions are specific to mysql. There may be analogous functions for ODBC, you'll have to look them up. However, addslashes() will work in this case to escape all quotes, single and double.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.