Page 1 of 1

PHP Syntax

Posted: Fri Aug 19, 2005 8:57 am
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>';

Posted: Fri Aug 19, 2005 9:03 am
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.. :?

Posted: Fri Aug 19, 2005 9:05 am
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:

Posted: Fri Aug 19, 2005 9:31 am
by quadoc
Thanks for the tips guys. Is there a PHP Syntax checker utility out there that I can use? Thanks... :)

Posted: Fri Aug 19, 2005 9:35 am
by feyd
php :P

seriously.. who would better do syntax checking than the language itself?

Posted: Fri Aug 19, 2005 9:43 am
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. :)

Posted: Fri Aug 19, 2005 9:48 am
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]> _