You are here: mysql_real_escape_string() chopping off after quotes « PHP Programming Language « IT news, forums, messages
mysql_real_escape_string() chopping off after quotes

Posted by Paul Furman on 08/09/07 22:57

mysql_real_escape_string() is apparently chopping off anything that
follows a quote when I grab the data & put it in a form for editing.
Sorry if I'm not explaining this properly, I'm pretty confused about
what's going on but I'm guessing someone recognizes this problem.

I have code like this:

function db_safe($str) {
$str = addslashes($str);
return $str;
}

function html_safe($str) {
$str = stripslashes($str);
return $str;
}

That's on my live server, I'm not sure if magic quotes is on there or I
forgot to update because my test server version look like:

function db_safe($str) {
// $str = addslashes($str);
$str = mysql_real_escape_string($str);


Anyways then there's code like this:

if (isset($_REQUEST["submit"])) {
$latin_name = html_safe($_REQUEST["latin_name"]);


if ((isset($_REQUEST["option"])) && ($_REQUEST["option"] == "update")) {
$id = $_REQUEST["id"];
$latin_name=db_safe($latin_name);


and this is where it's chopping off text after the quote:


<form action=.......
<input type='text' size='57' name='latin_name' value="<?=$latin_name?>">

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация