PHP Syntax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
quadoc
Forum Contributor
Posts: 137
Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA

PHP Syntax

Post by quadoc »

I've the following code that suppose to have a link and display the tooltip when user hover the mouse over it, but I keep getting error message. Could someone tells me what I did wrong and post some tips. Thanks... :?

Code: Select all

'<td bgcolor="'.$cellcolor.'"><a href="?x=read&id='.$id.'" class="link">'.$subject.' onMouseover="showtip(this,event,'<?=$desc_1?>')"'.' onMouseout="hidetip()"><?=substr($subject,0,30)?>'</a></td>';
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

echo  '<td bgcolor="'.$cellcolor.'"><a href="?x=read&id='.$id.'" class="link" '.$subject.' onMouseover="showtip(this,event,'.$desc_1.')" onMouseout="hidetip()">'.substr($subject,0,30).'</a></td>';
not quite sure what you are doing with $subject in the middle of the link code though.. :?
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

Code: Select all

onMouseover="showtip(this,event,'.$desc_1.')" //notice the comma after this
think should be

Code: Select all

onMouseover="showtip(this.event,'.$desc_1.')"
your quotes were so confusing :roll:
User avatar
quadoc
Forum Contributor
Posts: 137
Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA

Post by quadoc »

Thanks for the tips guys. Is there a PHP Syntax checker utility out there that I can use? Thanks... :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

php :P

seriously.. who would better do syntax checking than the language itself?
User avatar
quadoc
Forum Contributor
Posts: 137
Joined: Fri Jul 01, 2005 5:33 pm
Location: Atlanta, GA

Post by quadoc »

no, what I meant is, is there a PHP Syntax Checker editor. PHP doesn't tell me the error until you run the script. :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can line the script:

Code: Select all

[feyd@home]> php -l script.php
PHP Parse error:  syntax error, unexpected T_ECHO in script.php on line 4

Parse error: syntax error, unexpected T_ECHO in script.php on line 4
Errors parsing script.php

[feyd@home]> _
Post Reply