Forum Moderators: coopster

Message Too Old, No Replies

error in displaying MySql table in html

in the html output all the apostrophes have a slash before them

         

tito

12:14 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



Hello,

i'm using this code to display a MySql table into my web pages, but sometimes the result come out with a slash before all apostrophes, like this text example:
<td>at \'The House of Love\'</td>
these appearing slashes are also making unreadable all hyperlinks in the html output.

here's the code i'm using to display MySql table, please do you find any bug that may cause this slash problem?

thanks in advance,
tito

-----------------------------------

mysql_select_db("mix");
$query = "select * from x_data";
$result = mysql_query($query);

$num_results = mysql_num_rows($result);

echo "<p>Total Mixes: ".$num_results."</p>";

$output = "
<table>

<thead>
<td><b>Dj</b></td>
<td><b>Mix</b></td>
<td><b>Genre</b></td>
<td><b>Date</b></td>
<td><b>Tracklist</b></td>
<td><b>Time - Size - Bit Rate</b></td>
<td><b>Stream</b></td>
<td><b>Download</b></td>
<td><b>mp3</b></td>
</thead>
";

while ($row = mysql_fetch_array($result)){

$output .= "
<tr>
<td>".$row["dj"]."</td>
<td>".$row["mix"]."</td>
<td>".$row["genre"]."</td>
<td>".$row["date"]."</td>
<td>".$row["tracklistfeedback"]."</td>
<td>".$row["info"]."</td>
<td>".$row["stream"]."</td>
<td>".$row["download"]."</td>
<td>".$row["mp3"]."</td>
</tr>
";

}

$output .= "
</table>
";

print $output;

include ("includes/footer.inc");
?>

-----------------------------------

dreamcatcher

4:06 pm on Jun 24, 2005 (gmt 0)

tito

7:28 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



Thanks for the link dreamcatcher, i have problems in placing the stripslashes function inside my code, please can you give me a clue?

tito

arran

7:42 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



Try the following:


$output .= "
<tr>
<td>".stripslashes($row["dj"])."</td> etc.

tito

9:27 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



Thanks so much Arran.