Link to home
Start Free TrialLog in
Avatar of CWS (haripriya)
CWS (haripriya)Flag for India

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



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 &pound;' . $price;
		}
echo $msg;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of segurah
segurah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CWS (haripriya)

ASKER

Some where in my php page where this ajax function is called, $price=' ' is set to empty. I wonder how this conflicts the value comes from ajax. I tried $price1 instead of $price, surprisingly the value of $price1 gets displayed. I would like to leave this issue with this.

Thanks for your time.