Adding value above query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leewad
Forum Commoner
Posts: 91
Joined: Tue May 11, 2004 8:32 am

Adding value above query

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Adding value above query

Post 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.
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

Re: Adding value above query

Post by azycraze »

use function my friend!!!
stanliwise
Forum Newbie
Posts: 5
Joined: Mon Dec 23, 2013 5:00 am

Re: Adding value above query

Post by stanliwise »

Alway define a variable before using them.
Or rather use function instead, which is more dynamic.
stanliwise
Forum Newbie
Posts: 5
Joined: Mon Dec 23, 2013 5:00 am

Re: Adding value above query

Post 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
}
Post Reply