Jago6060 Posted October 1, 2007 Share Posted October 1, 2007 I have my script working as far as showing the tooltip but the tooltip contains an apostrophe and wont show anything after that. heres the code that displays it. <? include 'connect.php'; $tdcount = 0; @mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT * FROM feature_images ORDER by img_id"; $result=mysql_query($sql); $num=mysql_numrows($result); mysql_close(); echo "<table border=8 bordercolor=#000060 align=center cellspacing=10 cellpadding=10><tr>"; $i=0; while ($i < $num) { $d1=mysql_result($result,$i,"img_id"); $d2=mysql_result($result,$i,"img_dir"); $d3=mysql_result($result,$i,"cap"); $img_dim = getimagesize($d2); $width = ($img_dim[0]); $height = ($img_dim[1]); $count = 0; do {$count++; $width = ($img_dim[0]/$count); $height = ($img_dim[1]/$count); } while (($width > 100) && ($height > 100)); echo "<td><center><img src=$d2 border=0 width='$width' height='$height' title='$d3'></center></td>"; $tdcount++; $i++; if ($tdcount == 3){ echo "</tr>"; $tdcount = 0; } } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/71392-solved-trouble-displaying-tooltip-containing-an-apostrophe/ Share on other sites More sharing options...
wildteen88 Posted October 1, 2007 Share Posted October 1, 2007 use htmlentities with the ENT_QUOTES flag for the $db variable: echo "<td><center><img src=$d2 border=0 width='$width' height='$height' title='" . htmlentities($d3, ENT_QUOTES) . "'></center></td>"; Quote Link to comment https://forums.phpfreaks.com/topic/71392-solved-trouble-displaying-tooltip-containing-an-apostrophe/#findComment-359322 Share on other sites More sharing options...
Jago6060 Posted October 1, 2007 Author Share Posted October 1, 2007 thanks, works perfectly Quote Link to comment https://forums.phpfreaks.com/topic/71392-solved-trouble-displaying-tooltip-containing-an-apostrophe/#findComment-359327 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.