944,141 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4134
  • PHP RSS
Jul 17th, 2006
0

<script language=\"javascript\"> Display problem with PHP & MYSQL

Expand Post »
Hi !
When I want to display following code by assigning it to $res["description"] , in the following mentioned way, it works fine and displays properly. The code is :
/************START CODE*****************/
<script language=\"javascript\">
var uri = 'http://impgb.tradedoubler.com/imp/img/16173558/1014659?' + new String (Math.random()).substring (2, 11);
document.write('<a href=\"http://clkuk.tradedoubler.com/click?p=37983&a=1014659&g=16173558&epi=$_SESSION[UID]\" target=\"_blank\"><img src=\"'+uri+'\" border=0></a>');
</script>
/***********END CODE******************/

<tr>
<td colspan="4"><div align="center">
<?php
$res["description"] = "<script language=\"javascript\">
var uri = 'http://impgb.tradedoubler.com/imp/img/16173558/1014659?' + new String (Math.random()).substring (2, 11);
document.write('<a href=\"http://clkuk.tradedoubler.com/click?p=37983&a=1014659&g=16173558&epi=$_SESSION[UID]\" target=\"_blank\"><img src=\"'+uri+'\" border=0></a>');
</script>";

echo $res["description"];

?>
</div></td>
</tr>



But when I get the value of $res["description"] from database , then nothing displays. I am using PHP and MYSQL and I have also confirmed that there is an entry in database with same code.

Thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dr_dumb99 is offline Offline
3 posts
since Sep 2004
Jul 17th, 2006
0

Re: <script language=\"javascript\"> Display problem with PHP & MYSQL

Have a look at the source that is generated by the above code. You will no doubt see that there are errors in the generated source caused by escaped/unescaped characters from the database.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Jul 19th, 2006
0

Re: <script language=\"javascript\"> Display problem with PHP & MYSQL

Some characters do not get saved to a MySQL database, due to the way MySQL handles information. If your string you're inputting into a text or varchar field includes one of these symbols, ' for example, none of your information will be placed into the database.

You can solve this by using the html_special_chars() function to convert your code into HTML characters that are safe for storage.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mr Violent is offline Offline
22 posts
since Mar 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: integrate phpbb
Next Thread in PHP Forum Timeline: File upload problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC