| | |
<script language=\"javascript\"> Display problem with PHP & MYSQL
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2004
Posts: 3
Reputation:
Solved Threads: 0
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
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
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.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Mar 2005
Posts: 22
Reputation:
Solved Threads: 0
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.
You can solve this by using the html_special_chars() function to convert your code into HTML characters that are safe for storage.
![]() |
Similar Threads
- "Must visit from" javascript wont work in IE... (JavaScript / DHTML / AJAX)
- Help With PHP & Javascript (PHP)
- "Back" mess up Language Selection Code (ASP.NET)
- "<SCRIPT SRC>" javascript logon help (JavaScript / DHTML / AJAX)
- "Must visit from" javascript wont work in IE... (Site Layout and Usability)
Other Threads in the PHP Forum
- Previous Thread: integrate phpbb
- Next Thread: File upload problem
| Thread Tools | Search this Thread |
5.2.10 action apache api array beginner beneath binary broken cakephp checkbox class classes cms code cron curl database date destroy display dynamic echo echo$_get[x]changingitintovariable... email encode error fcc file files folder form forms function functions google header howtowriteathesis href htaccess html image images include insert ip javascript joomla limit link local login mail memberships menu mlm mod_rewrite multiple multipletables mysql mysqlquery neutrality oop open passwords paypal pdf php provider query radio random record remote rss script search server sessions sockets source space sql strip_tags syntax system table template thesishelp tutorial update upload url validator variable video voteup web window.onbeforeunload=closeme; youtube





