Ask about a PHP problem here.
toqi786
Posts: 9 Joined: Mon May 16, 2011 12:43 pm
Post
by toqi786 » Mon May 16, 2011 10:55 pm
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
jacek
Site Admin
Posts: 3262 Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:
Post
by jacek » Mon May 16, 2011 11:07 pm
You cant set a variable equal to an echo statement
What are you trying to do here ?
toqi786
Posts: 9 Joined: Mon May 16, 2011 12:43 pm
Post
by toqi786 » Mon May 16, 2011 11:10 pm
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!
jacek
Site Admin
Posts: 3262 Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:
Post
by jacek » Mon May 16, 2011 11:12 pm
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;
??
toqi786
Posts: 9 Joined: Mon May 16, 2011 12:43 pm
Post
by toqi786 » Mon May 16, 2011 11:20 pm
yes it was thanx! all i had to do is get rid of the echo lol
thanx for the help man!!
jacek
Site Admin
Posts: 3262 Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:
Post
by jacek » Mon May 16, 2011 11:27 pm
toqi786 wrote: yes it was thanx! all i had to do is get rid of the echo lol
thanx for the help man!!
no problem