CWS (haripriya)
asked on
what is wrong with this code?
The below code does not display the price value.
With line : $msg = 'Your Price is £' . $price;
when I echo the value of $msg, it displays like this: Your Price is £
Whereas With line : $msg = 'Your Price is £' . $row['price'];
when I echo $msg, it displays the price. Your Price is £64
what is wrong with the below code? It was working perfect few minutes back when the code was in the same php page. Now I wanted to use AJAX so I copied this code in a seperate page.
I want to know why this happens.
Any help or suggestion is appreciated.
Thanks
With line : $msg = 'Your Price is £' . $price;
when I echo the value of $msg, it displays like this: Your Price is £
Whereas With line : $msg = 'Your Price is £' . $row['price'];
when I echo $msg, it displays the price. Your Price is £64
what is wrong with the below code? It was working perfect few minutes back when the code was in the same php page. Now I wanted to use AJAX so I copied this code in a seperate page.
I want to know why this happens.
Any help or suggestion is appreciated.
Thanks
if ($row)
{
//item price
echo "<br>row=";
$price = $row['price'];
echo $row['price'];
//item id
$id = $row['id'];
//write id & price to session
session_start();
$_SESSION['price'] = $price;
$_SESSION['id'] = $id;
$_SESSION['description'] = $description;
$_SESSION['colors'] = $colours;
$msg = 'Your Price is £' . $price;
}
echo $msg;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your time.