Jump to content

Filter Forum Data Before I Put It In Mysql Data Bace? (solved)


migroo
 Share

Recommended Posts

I have a forum and I want it to submit all the user impute to a MYSQL data base, not a problem. But before it submits the data I want it to take all the full/half quotes, maybe some other characters too and replace them with there respective ASCII character. I don't have a clue how to go about this. Can anyone help me?P.S. Woot I am back my computer crashed and it took me a long time but I got all my old programs back and am finally up and butchering code again! I hate reformatting my HD.Never mind I got it I found it on another forum.Its: str_replace(" ","", $td)

Edited by migroo
Link to comment
Share on other sites

I have alway had one problem with that site I do not know how to read there explanations of coding.

string htmlspecialchars ( string $string [, int $quote_style = ENT_COMPAT [, string $charset [, bool $double_encode = true ]]] )
How should I read this?Here are my variables:$tr= The title typed by the user$r=random number from 1-20000So to use this code I would type something like...
$m="ztable_".htmlspecialchars($tr, I don't really know what goes here).r;

Sorry I am new to this and have trouble with things like this.What does:

[, int $quote_style = ENT_COMPAT [, string $charset [, bool $double_encode = true ]]]
Mean?Thank you for showing me that site and I would be very glad to learn how to use it. I looked around at it for a while and there is A LOT of PHP reference help there!
Link to comment
Share on other sites

See How to read a function definition (a manual page about the manual... odd, I know...) for a detailed explanation.If you read the documentation of the second argument, it says:

quote_style The optional second argument, quote_style , tells the function what to do with single and double quote characters. The default mode, ENT_COMPAT, is the backwards compatible mode which only translates the double-quote character and leaves the single-quote untranslated. If ENT_QUOTES is set, both single and double quotes are translated and if ENT_NOQUOTES is set neither single nor double quotes are translated.
ENT_COMPAT, ENT_NOQUOTES and ENT_QUOTES are all predefined constants. Look at the example script, furher below on that page.
Link to comment
Share on other sites

I did I read the whole page I just wasn't understanding how to set ENT_COMPAT, ENT_NOQUOTES and ENT_QUOTES. It just says SET and I am new to programing so that just didn't really help but I got it now THANK YOU.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...