Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

save textarea from flash to Mysql db using lines

Posted on 2005-05-03
7
Medium Priority
?
316 Views
Last Modified: 2011-09-20
Hello, I'm trying to save the text on my textArea from flash into Mysql Database, but when I save it, do not respect the lines. If I put:

aaa
bbb
ccc

in Mysql database I see aaabbbccc.

The code that I have in php is this:

<?php

$key3 = $HTTP_GET_VARS[nota];


$actualitza = mysql_query("UPDATE comanda SET nota ='".$key3)"'");

?>

what can I do?

thanks
0
Comment
Question by:jbadia
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:alain34
ID: 13916332
first you should use a post method as opposed to a get, because get variable are url translated!
second you should convert return carriage to something like <br /> therefore you are sure that it will displayed correctly when send to a browser!
0
 

Author Comment

by:jbadia
ID: 13916530
How can I convert return carriage to <br />?

then, my code will be similar to this?

<?php

$key3 = $HTTP_POST_VARS[nota];


$actualitza = mysql_query("UPDATE comanda SET nota ='".$key3)"'");

?>
0
 
LVL 16

Assisted Solution

by:alain34
alain34 earned 800 total points
ID: 13916691
$key3    = str_replace ("\n", "<br />", $HTTP_POST_VARS[nota]);
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jbadia
ID: 13917238
I've tried but now, it don't save nothing.
In my flash I have this code to send variables:

on (press) {

 loadVariablesNum("insertvendes.php?nota="+_parent._parent.nota.text, 0);
}

Now, in my php, this:

<?php
$key3 = str_replace ("\n", "<br />", $HTTP_POST_VARS[nota]);
$actualitza = mysql_query("UPDATE comanda SET nota ='".$key3."'");
?>
0
 
LVL 16

Expert Comment

by:alain34
ID: 13917522
I don't know flash, but I'm afraid this way a post will not work.
you need to revert to GET unless you know how to post data from flash!
0
 

Accepted Solution

by:
phonglong earned 200 total points
ID: 13924138
I don't know how to post data in flash either, but if you want to use your current method, add in a delimiter like && into your text before you send it from flash... so have flash replace carriage returns or line feeds to &&, then you should get this in your php script:

aaa&&bbb&&ccc&&

i'm not familiar at all with flash scripting to tell you how to do it in flash, but this page i found on google seems to point in the right direction:

http://www.flzone.net/showDetail.asp?TypeId=44&NewsId=7678

the next thing to do would be to do a

$key3 = str_replace ( "&&", "\n", $key3 );

then insert into mysql.  kinda hacky, but i hope that helps

good luck.
0
 

Author Comment

by:jbadia
ID: 13925471
thanks guys
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn different types of Android Layout and some basics of an Android App.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question