[size=8pt] I am not a php coder, nor will I ever be. It is however too useful to ignore in certain situations. As a result I know just enough php to hack some scripts/functions/etc together into something functional. Occasionally I run up against a situation where several hours of research has failed to provide an answer I can fathom. Hence this question. Not lazy, just stumped. [/size]
Using php to upload form fields to mysql db (unusual application huh?). Works fine and takes usual security steps to prevent injection with or without magicquotes. As a result some of the user entered text strings contain \ characters within the db fields. Again, expected and not a problem. Problem lies when attempting to retrieve and display data by echoing results of a fetched array. Example code below (Assumes connection to db exists)
[php] $data = mysql_query(“SELECT * FROM table_name”) or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
Echo “” . $info[‘field_one’] . “
”;
Echo “” . $info[‘field_two’] . “
”;
Echo “” . $info[‘field_three’] . “
”;
Echo “” . $info[‘field_four’] . “
”;
}
[/php]
Understand from my reading, that I cannot use stripslashes function on the entire array ($info) but the explanations and syntax in the examples I found on how to explicitly strip slashes from individual fields (Don’t need to do all of them) were beyond my ability to absorb.
An example of how to explicitly strip slashes from say 'field_two' and 'field_four' while not bothering with the rest, inserted into the above snippet would be a tremendous help.
Again, not interested in altering the actual db entry, just want " O'Neill " not to echo as O\"Neill.
TIA