Jump to content

functions


brown2005

Recommended Posts

hi, i have the following function;

function WebsiteCost()
{

$WebsiteCost_sql = "SELECT *
                FROM z_website 
WHERE website_title='COST'
LIMIT 1;";

$WebsiteCost_query = mysql_query($WebsiteCost_sql) or die(mysql_error());

while($WebsiteCost_array = mysql_fetch_array($WebsiteCost_query))
{

$WebsiteCost = $WebsiteCost_array['website_text'];

return $WebsiteCost;

}

}

then

echo WebsiteCost();

will echo £5, but what i wanted to know is can you have two values in the function i.e.

function WebsiteCost()
{

$WebsiteCost_sql = "SELECT *
                FROM z_website 
WHERE website_title='COST'
LIMIT 1;";

$WebsiteCost_query = mysql_query($WebsiteCost_sql) or die(mysql_error());

while($WebsiteCost_array = mysql_fetch_array($WebsiteCost_query))
{

$WebsiteCost = $WebsiteCost_array['website_text'];

                          $WebsiteCostDisplay = "£ $WebsiteCost.00";

return $WebsiteCost;

}

}

and how can i echo out the $WebsiteCostDisplay if you can?

PLEASE
Link to comment
https://forums.phpfreaks.com/topic/35210-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.