TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-12-2008, 01:27 AM   #1 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default Adsense Code problems

I have a wierd problem with my google adsense. I am trying to store the code in mysql and print it from a variable so that I can display different ads easily.

Problem is the google adsense does not show. It is in the source It creates a large area that it could fit into, but doesnt show the ad. If I hard code in the script it works just fine.

Im using mysql and I have tried storing the code in a varchar and in a text field.

Any Ideas?
CoryMathews is offline  
Reply With Quote
Old 07-12-2008, 07:06 PM   #2 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

You sure the code is exact? I know the google code actually creates an iframe, but that does not seem like the likely reason. If you are putting the exact adsense code into the database, and simply retrieving it and outputing it, everything should work accordingly. Can you post your code?
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-12-2008, 07:30 PM   #3 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

here is what the page outputs if you view the source.
Ijust added some spacing to see it better.
Code:
<div class="rightArea">
  <script type="text/javascript">
  <!--  google_ad_client = "pub-9855112947620642";  
    /* tuts234x60 */  
    google_ad_slot = "8462468271";  
    google_ad_width = 234;  
    google_ad_height = 60;  
  //-->  </script>  
  <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">  </script>
</div>
And copied strait from the google site here is the ad.

Code:
<script type="text/javascript"><!--
google_ad_client = "pub-9855112947620642";
/* tuts234x60 */
google_ad_slot = "8462468271";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
And the php code that outputs it.
Query
PHP Code:
while($r=mysql_fetch_array($InfoResult)) {        
  
$ExtraInfo=$r["ExtraInfo"]; 
  
$Ad=$r["Ad"];
  
$Ad2=$r["Ad2"]; 

Some other code then
Output
PHP Code:
echo "<div class=\"rightArea\">
  
$Ad
</div>"

CoryMathews is offline  
Reply With Quote
Old 07-13-2008, 01:10 AM   #4 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

*double post*

Everytime I go to edit something I end up putting it in the quick reply by accident grr.
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-13-2008, 01:11 AM   #5 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Ah, you are commenting out your google ad id with this line:
Code:
<!--  google_ad_client = "pub-9855112947620642";
Make sure there is a new line (return) after the <!-- part

Do you see the difference where the one copied straight from google, the <!-- is on a different line:

Code:
<script type="text/javascript"><!--
google_ad_client = "pub-9855112947620642";
I am guessing since google has no ID for you, they wont display anything.
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:27 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design