Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 06:22
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  PHP, Perl, ASP, JSP, CFM (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis, nothingGrinder)
| | |-+  whats the best way to insert flash text into mySql database with php?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: whats the best way to insert flash text into mySql database with php?  (Read 5211 times)
Pluda
Senior Programmer
****
Posts: 270


View Profile
« on: 11/22/08, 12:06 »

Hello,

I use to insert textfield text into mySql database using php, but I usually get erros when using some letters or some simbols.

As my natural language has accents, uses the euro simbol and people usualy want to use " " when they are per example mentioning to someone else, I need to have a efficient way of archieve "clean" text or html text.

What is the best way to make this?

I ussually use in php echo utf8_encode("something") and I'm trying to implement te mysql_real_escape_string before insert the records on database, but Flash doesn't read those texts

thanks

Pluda
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #1 on: 11/22/08, 16:21 »

Flash expects utf8 encoded text.

After " is used to mark a textstring, you have to escape it with \ to make sure it is not seen as a delimiter.

And another special character is the &, which needs to be replaced while transfered to flash, because flash sees it as a variable delimiter.

Logged

happy flashing
Cool
Ronald
Pluda
Senior Programmer
****
Posts: 270


View Profile
« Reply #2 on: 11/22/08, 16:57 »

Hello Ronald, thanks for reply

so, do you think using this

$vars = preg_replace("/&/","%26",$vars);

is a good practice? how abaut the euro simbol €, i usualy have some problems with it.

and to finish another one, most of my clients use word or excel and then they copy / paste text to flash input textFields.
the problem is that those microsoft programs use \t and some other strange delimiters.

do you think i should use

strip_tags($valores, '<a><b><i><u><p><font>');

to just allow pure html tags to be archieved into database?

Thanks
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #3 on: 11/23/08, 09:49 »

this realy very much depends on your application.
At least you have to take care of the characters harming your functions.
What to store is a decision to be made by the functionality of your application.
If people insert from excel and expect to get the results back into axcel, you have to take care of this.
If it is plain information, and format is not an issue, you can strip everything out.
If you present the results in a flash text area, you can strip all away, which cannot be used by the text box.
If you expect quotes, double quotes and ampersend characters, and want to keep them, you have to find a strategie to replace the intelligently back and forth.
Logged

happy flashing
Cool
Ronald
Pluda
Senior Programmer
****
Posts: 270


View Profile
« Reply #4 on: 11/23/08, 12:17 »

Hello,

the goal is to be able of receive information of any software, store it in database and display it in flash textArea or TextField.

"If you present the results in a flash text area, you can strip all away, which cannot be used by the text box."

what should I do to have a full compatible format to be used by both textArea and TextField, text box?

Thanks
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything