Special Characters - MySQL considerations

Inputting special characters into MYSQL database.

When saving input data into the data base make sure that slashes are added to any special characters, like quotes, that would cause problems in the query. There is the issue of whether magic_quotes are set, so must test for them first. Use the "slash_it" function in common/utility_functions to take care of both the slashes and the magic_quotes issue.

This function works as follows:

function slash_it($instr)

Converts input string to one with quotes slashed to protect the integrity of the query must test for magic quotes first.

Use this function for any user input text that is to be submitted into a data base record.



    // If Magic Quotes, no need to do anything



    // Otherwise strip the slashes

    return addslashes($instr);