Search the Community
Showing results for tags 'html_entity_decode'.
-
Hello - I am trying to view a table in database that were entered as from a wysiwyg editor. When i export the data it isnt really readable. So i found this little script and was trying to output the data so i could copy it to excel. i am able to get the data out but then it looks like this... <p class="body"> <span style="font-size: 14px;"><span style="color: rgb(0, 0, 255);">Features:</span></span></p> <p> <span style="font-weight: bold;">• Over-sized 0.58" ID for high flow<br /> • Heavy duty 0.25" wall thickness for durability<br /> • Self-weighted for easy installation<br /> So i am trying to output that data without all of the HTML tags using the html_entity_decode, can anyone see where i am going wrong with the below code? <?php // set database server access variables: $host = "localhost"; $user = "*****"; $pass = "********"; $db = "************"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT * FROM product_description"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $html_decoded = utf8_encode(html_entity_decode($row[6])); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>".$row[2]."</td>"; echo "<td>".$html_decoded."</td>"; echo "<td>".$row[6]."</td>"; // This outputs the row to look something like this [color=#000000][font=Times][size=1]<p class="body"> <span style="font-size: 14px;"><span style="color: rgb(0, 0, 255);">Features:[/size][/font][/color] echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "No rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?>