Re: parse error, unexpected T_CLASS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dasmeet Singh wrote:
> Jay Blanchard wrote:
>> [snip]
>> echo ("<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
>> Property Type- $ptype<br>Min Price- $row[9] </div>");
>>
>> it gives an error..
>>
>> Parse error: parse error, unexpected T_CLASS in
>> /home/real/public_html/functions.php on line 162
>>
>> Any idea..why? Probably any stupid mistake .. :(
>> [/snip]
>>
>> Takes the parentheses out.
>>
>> echo "<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>
>> Property Type- $ptype<br>Min Price- $row[9] </div>";
>>
>> From http://www.php.net/echo "echo() is not actually a function (it is a
>> language construct) so you are not required to use parentheses with it.
>> In fact, if you want to pass more than one parameter to echo, you must
>> not enclose the parameters within parentheses."
>
>
> Removed the ()..still the same error :(.. am copying complete
> function..if its because of something else...
>
> function showProperty($filter, $by, $value)
> {
> if($filter==true)
>    {
>        $query="SELECT * FROM `Property` WHERE ".$by." = '".$value."'
> ORDER BY DateAdded DESC";
>
>    }
> else
>   {
>        $query="SELECT * FROM `Property`ORDER BY DateAdded DESC;

Missing the ending " above.  So this line would be:
$query="SELECT * FROM `Property`ORDER BY DateAdded DESC";

>   }
>
> $result=db_query($query);
> while($row=mysql_fetch_row($result))
>   {
> $ptype= getName('propertyTypes', 'id', $row[8] , 'Name');
> echo "<div class=pmini> <h1> $row[1] </h1> <p> Location- $row[4] <br>

PHP thinks this is the ENDING " instead of the BEGINNING ".  So when the
parser reaches the text that says "<div class" it is trying to interpret
that instead of treating it like a string.  Fix the quote error above
and all should be fine.

> Property Type- $ptype<br>Min Price- $row[9] </div>";
> }
> }
>
> -
> Free Website Promotion - A Complete Guide
> http://hostwindow.info/web-hosting/9/free-website-promotion/1/


--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux