colleyboy Posted September 20, 2010 Share Posted September 20, 2010 Ok mixing javascript with php.... im having bugs . I basically want to replace any broken image links with a picture "noimage.gif" in the images folder. I tried this code but am getting the error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/wormste1/public_html/tilburywebdesign/shop/FTPServers/barryottley/showroom.php on line 78 This is the javascript header - all seems fine: <script language="JavaScript" type="text/javascript"> function ImgError(source){ source.src = "/images/noimage.gif"; source.onerror = ""; return true; } </script> this is the code thats erroring... is it the way ive written in the code into the IMG tag? while($row = mysql_fetch_array($result)){ echo "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100% BORDER=0>"; echo "<TR />"; echo "<TD WIDTH=30% VALIGN=TOP />"; echo " <A HREF='images/".$row['photo']."' target=_blank><IMG SRC='images/".$row['photo']."' width=186 height=155 border=0 onerror="ImgError(this);" /></A> "; echo "<br />"; echo "</TD>"; echo "<TD WIDTH=10 VALIGN=TOP />"; Quote Link to comment Share on other sites More sharing options...
the182guy Posted September 20, 2010 Share Posted September 20, 2010 Change that line to echo " <A HREF='images/".$row['photo']."' target=_blank><IMG SRC='images/".$row['photo']."' width=186 height=155 border=0 onerror=\"ImgError(this);\" /></A> "; Quote Link to comment Share on other sites More sharing options...
colleyboy Posted September 20, 2010 Author Share Posted September 20, 2010 Many thanks ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.