Hi,
I have a database with a column named "field1". This column stores either the value 1, 2 or 3. In my chronoconectivity I want this to be displayed as a text, for exampel, if the value is 2 I want the text "Hello" to be shown instead of "2".
I have put this code in the body field in my cc:
But for every line in the database it prints "Goodbye", even thou there are values of 2 in it.
I have a database with a column named "field1". This column stores either the value 1, 2 or 3. In my chronoconectivity I want this to be displayed as a text, for exampel, if the value is 2 I want the text "Hello" to be shown instead of "2".
I have put this code in the body field in my cc:
<?php
$v_field1 = '{field1}';
if ($v_field1 == 2)
$field1 = "Hello";
else
$field1 = "Goodbye";
echo $field1;
?>
But for every line in the database it prints "Goodbye", even thou there are values of 2 in it.
Hi PP,
Variables in the body section of ChronoConnectivity are not directly available from PHP. Try this instead:
Neil.
Variables in the body section of ChronoConnectivity are not directly available from PHP. Try this instead:
<?php
$v_field1 = '$MyRow->field1';
if ($v_field1 == 2)
$field1 = "Hello";
else
$field1 = "Goodbye";
echo $field1;
?>
Neil.
I was trying to do something similar to this to add bold and font color to my text (in my case, indicating the word NO in red bold and YES in regular font). The field in question was a char() field, so the rules change a bit. The script worked when I removed the single quotes from "$MyRow->field1"
Here is my version of the code:
Here is my version of the code:
<?php
$v = $MyRow->meet_live;
if ($v == "YES")
$v = "YES";
else
$v = "<b><font color=#FF0000>NO</font></b>";
echo $v;
?>
This topic is locked and no more replies can be posted.