Categories > TinyButStrong general >

PHP fonction on SQL result before showing it

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jorge
Date: 2004-01-05
Time: 06:39

PHP fonction on SQL result before showing it


My PHP File:

$TBS->MergeBlock("blk",$cnx_id,'select id, text from mytable')

My HTML File:

Id   /  text
[blk.id]   [blk.text; block=row]


The problem I have is that 'blk.text' content is text with stupid characters like'\'

So I would like to remove those '\' from 'blk.text' before showing it, something like in PHP:

$text= stripslashes($text)

How to do it?

Thanks
By: Skrol29
Date: 2004-01-05
Time: 13:31

Re: PHP fonction on SQL result before showing it

Hello,

The 'onformat' parameter is done for that.
Take care that there is a bad bug in the version <= 1.81 : For those versions, do not use the 'block' parameter and the 'onformat' parameter in the same TBS fied.

Here is what you can do :
HTML:
Id   /  text
[blk.id;block=row]   [blk.text;onformat=format_text]

PHP:
function format_text($FieldName,&$CurrVal) {
  $CurrVal=stripslashes($CurrVal) ;
}