Hi
I would like to show only the latest record from database, is it possible?
Is it possible to use javascript in body box?
I would like to show different images depending on the value in database field.
For example if the value is
>70-79 then show image1.jpg
80-89 then show image2.jpg
90-100 show image3.jpg
I would like to show only the latest record from database, is it possible?
Is it possible to use javascript in body box?
I would like to show different images depending on the value in database field.
For example if the value is
>70-79 then show image1.jpg
80-89 then show image2.jpg
90-100 show image3.jpg
Hi forwarddesign,
Bob
I would like to show only the latest record from database, is it possible?
Yes, provided that you have a way to identify the latest record. In CFv4 you can use the DB Record Loader action to get the information.Is it possible to use javascript in body box?
Yes, there is a Load JS action that you can put JavaScript (and PHP) into.Is it possible to use javascript in body box?
You can do this with a Custom Code element (I think) after the DB Record Loader action. (You don't need JavaScript for this.)Bob
I can see date and time for each record but how can I get the newest first and not last?
Can you give me a hint for the code too the images?
Can you give me a hint for the code too the images?
Hi forwarddesign,
An ORDER BY setting will sort the table on one or more columns.
The images require some simple PHP - probably an 'if . . . elseif' statement.
Bob
An ORDER BY setting will sort the table on one or more columns.
The images require some simple PHP - probably an 'if . . . elseif' statement.
Bob
Hi!
Now I´ve managed to get the ordering right thanks to some nice how-to-docs at greyhed.net🙂
I´m a little stuck with the php code since I´m still learning php
I´ve tried a bit but can´t get it right
This is how I would like it to bee
I really would appreciate if someone could give me a clue here!
Thanks!
Now I´ve managed to get the ordering right thanks to some nice how-to-docs at greyhed.net🙂
I´m a little stuck with the php code since I´m still learning php
I´ve tried a bit but can´t get it right
This is how I would like it to bee
<?php
if (text_4 is between 80-90) $img = 'images/image_1.png';
else if (text_4 is between 91-100) $img = 'images/image_2.png';
else $img = 'images/image_3.png';
?>
<p> {text_4} <img src="<?php echo $img; ?>"></p>
I really would appreciate if someone could give me a clue here!
Thanks!
Hi forwarddesign,
You should perhaps check out a basic PHP tutorial as a new year's present to yourself.
I think that the code should be something like this:
Bob
You should perhaps check out a basic PHP tutorial as a new year's present to yourself.
I think that the code should be something like this:
<?php
$text_4 = $MyRow['text_4'];
if ( $text_4 > 80 && $text_4 <= 90 ) {
$img = 'images/image_1.png';
} elseif ( $text_4 > 90 && $text_4 <= 100 ) {
$img = 'images/image_2.png';
} else {
$img = 'images/image_3.png';
}
?>
<p> {text_4} <img src="<?php echo $img; ?>"></p>
Bob
Hi again!
Thank you for the code it´s allmost perfect. It seems like the php code doesn´t get the value from text_4.
It seems like it´s
that doesen´t work. It gives mee a blank screen...
If i change
to a number ex. 80 it shows image1.png!
I´ve tried with
That returns the if else code and image3.png
Could you please help me with this?
Thank you for the code it´s allmost perfect. It seems like the php code doesn´t get the value from text_4.
It seems like it´s
$MyRow['text_4']
that doesen´t work. It gives mee a blank screen...
If i change
$MyRow['text_4']
to a number ex. 80 it shows image1.png!
I´ve tried with
$MyRow('text_4')
('text_4')
'text_4'
That returns the if else code and image3.png
Could you please help me with this?
Hi forwarddesign,
Oh, my mistake, it may be an object and not an array. Try $text_4 = $MyRow->text_4;
Bob
Oh, my mistake, it may be an object and not an array. Try $text_4 = $MyRow->text_4;
Bob
THANK YOU!!
You really saved my day!
And yes, you are right, I really should give my self a php course in present🙂
Tanks again!
You really saved my day!
And yes, you are right, I really should give my self a php course in present🙂
Tanks again!
This topic is locked and no more replies can be posted.