Hi,
I've searched for a while now but cannot find an answer to my problem.
My config: Win2K server, MS-SQL server 2000, Apache 2.2.9, PHP 5.2.6, Formhandler :)
Note: To avoid quote problems in this post I replace them with , (comma)
The problem:
I call the page (see code below): edit.php?order_id=2
The first time the field name is empty.
Then I fill it with AABB and press enter
The page reloads the form, it says okidoki, the value AABB is stored in de the database and the form contains AABB.
When I change it to AA,BB and press enter the same happens, which is fine. AA,BB in the database and in the form on the screen again.
Now...
When I close the browser and then reopen it (as a complete new load of the page and no cache or back function) and go to my page again the same way then it displays the following: AA\,BB which is bad.
But... The database contains AA,BB which is good.
Now when I only hit the save button the database is also goes bad AA\,BB.
Then it goes from bad to worse because the \ is escaped to \\ so I finally end up with unwanted \ in my database and on the screen.
My magic quotes are ON and that and the needs to stay that way because this is just one of many other scripts on my server.
Somehow somewhere there is a problem with the escaping of , and \
The php ini setting magic_quotes_gpc is not the issue.
I tested the problem without FH3 plain and simple and come to the conclusion that mssql_fetch_assoc escapes the database value so $ becomes \$.
This is on my server... I can't say it for others.
Is this also a setting which can be done in some ini file?
I've solved it for my situation but I guess some more attention is needed by you guys..
Somewhere somehow the addslashes, magicquotes, posts and database reads were not going as it should. This is my workaround:
<?
// file: fh3/yadal/class.mssql.php
function getRecord( $sql )
{
$record = mssql_fetch_assoc( $sql );
if (is_array($record))
{
foreach($record as $key=>$value)
{
$record[$key]=stripslashes($value);
}
}
return $record;
}
?>
<?
// file: fh3/fields/class.TextField.php
function getField()
{
// view mode enabled ?
if( $this -> getViewMode() )
{
// get the view value..
return $this -> _getViewValue();