This topic is locked

Display values

7/26/2011 7:57:25 AM
PHPRunner General questions
W
webdino author

Hello

I have a problem with display my values in the table
I have in database an varchar2 field. The values in the database are 1,2,3 in each field and so on...
Now I have this code in the "view as" in editor mask
first: I save the value in another variable

second: I explode the values in an array $split

third : I clear the variable $value

fourth: I loop the array $split and save it into a temp value

fifth: I change the value of the value field and replace the comma
but:

The values where shown in mask (

customer1,

customer2,

customer3
my target should be to display

customer1

customer2

customer3
I can not find my fault. Is there anyone who can help? Thank you



$x = $value;

$split = explode(",", $x);
$value ="";
for ($i = 0; $i < count($split); $i++){

$valuetemp =$split[$i];

$value .= str_replace(",","",$valuetemp)."
";
}
C
cgphp 7/26/2011
$split = explode(",", $value);

$str = "";

foreach($split as $item)

{

$str .= $item."<br/>";

}

$value = $str;
W
webdino author 7/27/2011

the comma is displayed still

C
cgphp 7/27/2011

I think there isn't a direct solution. The comma is automatucally added from PHPrunner. Also using a str_replace the comma is still there. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59716&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />

C
cgphp 7/27/2011

We have to wait for a reply from the team.

mikue from germany 7/27/2011

if ($value) {

$arr=explode(",",$value);

$value="";

foreach ($arr as $elem) {

$value.=$elem."
";

}

}
Greetings Michael

W
webdino author 7/27/2011



chgp has posted before
$split = explode(",", $value);

$str = "";

foreach($split as $item){

$str .= $item."<br/>";

}

$value = $str;


I can not see differences
thanks for your help

Sergey Kornilov admin 7/27/2011

webdino,
if you need help from support team post your project to demo account and contact support team directly.

W
webdino author 7/27/2011

okay I send it tomorrow, but the str_replace does not work and there must be an internal fault by PHPR
Where should I send the Number of Support FTP for the demo?

Sergey Kornilov admin 7/27/2011

Open a ticket at http://support.xlinesoft.com sending your Demo Account URL along with your order number and issue description.
PS. str_replace is a built-in PHP function. It just works.

More info: http://www.php.net/manual/en/function.str-replace.php

W
webdino author 7/28/2011



PS. str_replace is a built-in PHP function. It just works.

More info: http://www.php.net/manual/en/function.str-replace.php


I don´t know whar you mean? I have tested it with string replace, a dump output before display is correct but in the mask the PHPR wrote with comma

Sergey Kornilov admin 7/28/2011

You saying that str_replace doesn't work. I'm saying that this is unlikely to happen because str_replace is a built-in PHP function.
Anyway, how do you want us to help you?

C
cgphp 7/28/2011

Using an alias you should solve your issue. Show only the alias, as a custom field, in the list page and show only the original field in the add/edit pages. Enter in the custom field a query to retrieve the value of the original field:

global $conn;

$rs = CustomQuery("SELECT your_original_field_name FROM your_table_name WHERE primary_key_field_name =".$data['primary_key_field_name']." LIMIT 1",$conn);

$record = db_fetch_array($rs);

$value = str_replace(",","<br/>",$record['your_original_field_name']);