Displaying the variable name in the results

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
dthomas31uk
Forum Newbie
Posts: 19
Joined: Mon Oct 13, 2008 8:14 am

Displaying the variable name in the results

Post by dthomas31uk »

Hi. Have the following code it all works, but the actual result is displaying the name of the table in the results when I echo it. Is there a way of calculating the result first in a variable and then echoing the result in the variable. Sorry am new to all this. have tried
$result=$row['full_price'];
echo $result;
but no joy

Code: Select all

if ($load == 'full_load') {
  echo (" "). $row['full_price'];
} else {
  echo (" "). $row['half_price'];
}
 
dthomas31uk
Forum Newbie
Posts: 19
Joined: Mon Oct 13, 2008 8:14 am

Re: Displaying the variable name in the results

Post by dthomas31uk »

The result shows the following

Value of $load = full_load 100

full_load being the name of the field and the total 100. I dont want to show the name of the field in the result
dthomas31uk
Forum Newbie
Posts: 19
Joined: Mon Oct 13, 2008 8:14 am

Re: Displaying the variable name in the results

Post by dthomas31uk »

Have got it working guys cheers
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Displaying the variable name in the results

Post by aceconcepts »

Show your query
Post Reply