Jump to content

Echoing Special Characters


nightkarnation

Recommended Posts

Hey Guys, I think this is a question with a simple answer that I dont know...

 

I receive POSTS that have special characters like Accents on letters, (I dont want to Escape them) I need those characters, but my script is modifying them, heres the php script:

 

if ($action == "retrieveUserIdsStatus")
{

$p_id=mysql_real_escape_string($_POST['PId']);
$statusOne=mysql_real_escape_string($_POST['StatusOne']);
$statusTwo=mysql_real_escape_string($_POST['StatusTwo']);

if ($statusTwo == "Em Análise")
{
	$statusTwo = "Em Análise";
	$statusTwo = mysql_real_escape_string($statusTwo);
}

$result = mysql_query("SELECT DISTINCT user_id FROM users WHERE purchase_id = '$p_id' AND (status = '$statusOne' OR status = '$statusTwo')"); 
$cant = 0; 
    while($row=mysql_fetch_array($result))
{
	echo "user_id$cant=$row[user_id]&";
        $cant++;
    } 
    echo "cant=$cant&";
echo "status1=$statusOne&";
echo "status2=$statusTwo&";
if($result)
{
	$imdoneUpdate = true;
	echo "imdoneUpdate=".$imdoneUpdate;
} 
else 
{ 
	$imdoneUpdate = false;
	echo "imdoneUpdate=".$imdoneUpdate;
}
}

 

As you can see, I have to create the IF statement, because I am receiveing the $statusTwo variable as Em Análise when it is actually being sent as: Em Análise

 

Any ideas or suggestions on how I can fix this?

Thanks in advance!

Cheers,

Link to comment
https://forums.phpfreaks.com/topic/218146-echoing-special-characters/
Share on other sites

Replace this line:

 

$statusTwo=mysql_real_escape_string($_POST['StatusTwo']);

 

With this:

 

$statusTwo = $_POST['StatusTwo'];

 

Probably not such a good idea for security reasons and database vulnerability, but it might work as a temp fix.. Give it a shot!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.