Page 1 of 1

Variable Problem

Posted: Mon May 16, 2011 10:55 pm
by toqi786
Hey

I have a problem, I am using the following code
[line 141]if($Availability==1) {
			$Price = $row['Price'];
			$Price = echo "ONLY £$Price";
		} else {
			$Price = echo '<img src="../img/sold.png" width="163" height="122">';
		}
I am using this code and i am getting the following error
Parse error: syntax error, unexpected T_ECHO in /home/a5872994/public_html/pages/stocklist.php on line 143

Re: Variable Problem

Posted: Mon May 16, 2011 11:07 pm
by jacek
You cant set a variable equal to an echo statement :?

What are you trying to do here ?

Re: Variable Problem

Posted: Mon May 16, 2011 11:10 pm
by toqi786
I have like a stocklist table, if the availability in the database = 1 [its either 1 or 0] then i want to show the price if not i want to show the sold.png i have created to show that it is sold and not available!

Re: Variable Problem

Posted: Mon May 16, 2011 11:12 pm
by jacek
Did you mean to do this then...
if($Availability==1) {
     $Price = $row['Price'];
     $Price = "ONLY £$Price";
} else {
     $Price = '<img src="../img/sold.png" width="163" height="122">';
}

echo $Price;
??

Re: Variable Problem

Posted: Mon May 16, 2011 11:20 pm
by toqi786
yes it was thanx! all i had to do is get rid of the echo lol :D thanx for the help man!!

Re: Variable Problem

Posted: Mon May 16, 2011 11:27 pm
by jacek
toqi786 wrote:yes it was thanx! all i had to do is get rid of the echo lol :D thanx for the help man!!
no problem :D