Page 1 of 1

Adding value above query

Posted: Fri Dec 20, 2013 6:10 am
by leewad
Hi

I got a problem which cannot figure out, i need to display text above a calculation not after. for example

Code: Select all

echo "You can save £ $saving than your local shop";

$saving = 1000 / 0.7 ;
This is an example as all the calculations are pulled from the database but needs display above after database query. Could it be done using <div> tags?

Re: Adding value above query

Posted: Fri Dec 20, 2013 12:45 pm
by requinix
Maybe. We'd have to see more than just two lines of code to even understand what you're talking about, let alone show you what to change.

Re: Adding value above query

Posted: Mon Dec 23, 2013 11:04 pm
by azycraze
use function my friend!!!

Re: Adding value above query

Posted: Wed Dec 25, 2013 5:50 am
by stanliwise
Alway define a variable before using them.
Or rather use function instead, which is more dynamic.

Re: Adding value above query

Posted: Wed Dec 25, 2013 6:04 am
by stanliwise
Make sure you return the variable in the function.
Or better still add an amperstand in front of the variable "&" e.g
Function functionname( &$varible) {
Eval variable;
//do not return variable because you have us amperstand
}