BHCluster
Jun 6th, 2009, 12:47 PM
Hi everyone, let me start by explaining the problem which I am having. I have a simple php, mysql application that ads, edits and deletes records, however my problem arises when I redisplay some edited text in a way:
Lets say I use € symbol in html it is € so in my form entry I would write "€ 50" and save it so when the web page is viewed it will show € 50, so when I try to edit the number ot lets say 30 back in may edit page it will say €50 and when I re-save it it stores back into the db this "€ 50", so I was wondering if that has to do with php mysql special characters and how do I bypass it, any help is appreciated.
This is my code:
<?php
if ($nid>0) {
$query=mysql_query("SELECT * FROM `nekretnine` WHERE `nid`='".$nid."' LIMIT 1");
while ($fetch=mysql_fetch_assoc($query)) {
<form action="edit.php?id=<?php echo $nid; ?>" method="post">
print '<textarea id="textarea" type="text" name = "description" />'.$fetch['description'].'';
print ' </textarea>';
print '<input type="submit" value="Dodaj">';
print "</form>";
}
} else {
print '<tr><td colspan="4">Not Saved try again</td></tr>';
}
?>
I've red somwhere that I should use "html_entities(mysql_real_escape_string($variable));" but I don't know how to insert it in my code.
Thank you.
Lets say I use € symbol in html it is € so in my form entry I would write "€ 50" and save it so when the web page is viewed it will show € 50, so when I try to edit the number ot lets say 30 back in may edit page it will say €50 and when I re-save it it stores back into the db this "€ 50", so I was wondering if that has to do with php mysql special characters and how do I bypass it, any help is appreciated.
This is my code:
<?php
if ($nid>0) {
$query=mysql_query("SELECT * FROM `nekretnine` WHERE `nid`='".$nid."' LIMIT 1");
while ($fetch=mysql_fetch_assoc($query)) {
<form action="edit.php?id=<?php echo $nid; ?>" method="post">
print '<textarea id="textarea" type="text" name = "description" />'.$fetch['description'].'';
print ' </textarea>';
print '<input type="submit" value="Dodaj">';
print "</form>";
}
} else {
print '<tr><td colspan="4">Not Saved try again</td></tr>';
}
?>
I've red somwhere that I should use "html_entities(mysql_real_escape_string($variable));" but I don't know how to insert it in my code.
Thank you.