PDA

View Full Version : please help me with loadvars!!!!!


pfernandez59
03-26-2005, 11:28 PM
I'm newbee in flash mx and I've a big problem with loadvars and php. I've been using a script from toolbox which consists in one .fla file, one .as file and 4 .php files (insert, update, delete and gettabledata). The fla file, once compiled into swf, is a movie to edit-delete-insert records in a mysql database. The problem is: Once appended a new record in the database, the fields are stored with strange symbols like P%C3%A9rez%20G%C3%B3mez instead of Pérez Gómez. ¿IS IT POSSIBLE TO STORE RECORDS IN THE DATABASE WITHOUT THIS "IMPOSSIBLE MISSION" READING?

If it helps, here is the php code in insertContact.php:

<?php

mysql_connect("host","user","pass");
mysql_select_db("dbname");


$success = 1;

$ins_str = "INSERT INTO contacts VALUES (NULL, '".$HTTP_POST_VARS['contactType']."', '".$HTTP_POST_VARS['dorsal']."', '".$HTTP_POST_VARS['apellidos']."', '".$HTTP_POST_VARS['nombre']."', '".$HTTP_POST_VARS['domicilio']."', '".$HTTP_POST_VARS['cpostal']."', '".$HTTP_POST_VARS['poblacion']."', '".$HTTP_POST_VARS['telefono']."', '".$HTTP_POST_VARS['movil']."', '".$HTTP_POST_VARS['email']."', '".$HTTP_POST_VARS['fecha_nac']."', '".$HTTP_POST_VARS['altura']."', '".$HTTP_POST_VARS['posicion']."', '".$HTTP_POST_VARS['picFile']."')";

//echo $ins_str;

if (!mysql_query ($ins_str)) {
$success = 0;
$msg = 'Problem saving records to the database';
} else {
$msg = 'Record was saved successfully. Refreshing display...';
}

echo '&success='.$success.'&msg='.$msg.'&';

?>

THANK YOU VERY MUCH IN ADVANCE!!!! GREAT FORUM!!!!!

pyrocorp
03-28-2005, 06:22 AM
The strange data you are seeing is a result of the URL encoding. For example, %20 is the URL encoding for a space... your also getting this because of the special characters for your language, the letters with accent marks.

You have a couple of options:

1. leave the encoding in place in your database, this will preserve the accent marks, and decode it at the time of retrieval.

2 . strip the encoding, which may also strip out all special formatting.

I am not too familiar with foreign language characters being stored in database.

pfernandez59
03-28-2005, 08:40 PM
Thanks pyrocorp!!!

But,... the problem is how to decode from the database and show the registers in a php page?

Thank you for your interest!!!!

pyrocorp
03-28-2005, 10:44 PM
in your php try this:

echo rawurldecode($variable goes here);

same as,

echo rawurldecode('P%C3%A9rez%20G%C3%B3mez');