View Full Version : Can Someone Help me add a Google Adsense Script into a PHP FIle?

05-12-2009, 12:53 AM
else {


$query="SELECT img_links.part_id, img_links.link FROM img_links WHERE img_links.img_id=$img_id";
$query="SELECT * FROM img_parts WHERE img_parts.part_id=$part_id";
$TEMPLATE['KEYWORDS'] = $keywords ;
$TEMPLATE['DATA'] .= " <table width=100% border=0 cellspacing=2 cellpadding=0>
<td width=300 height=225><img src=".$part_link."images/".$img_link." width=300 height=225 border=1 alt=\"".$name." wallpaper\"></td>
<td rowspan=2 align=left valign=top>
<font color='#ff0000'><b>New!</b></font> <a href='http://download.freeze.com/lm/affiliate_downloads/samplewpaper_9767.exe'><b>Download a Free Wallpaper Pack!!!</b></a>
<b>How to use:<br>
</b><br> Wait until the picture has finished loading!<br><br>
<b>Windows Users (Windows 98/2000/XP):</b><br>Right click on the desktop picture and select 'Set as Background'
or 'Set as Wallpaper'. If you want to save it to your hard
disk just select 'Save image as...'
<p><b>Mac Users (For MAC O/S 8.0 and higher):</b><br>
Wait until the movie picture has finished loading, save the
image to your hard disk and use the control panel to set the
picture as your wallpaper. <br>

Here is where I want to place the Google script but it's not working? It gives me a blank page when I post it to the site...

<td width=50%>
<script type="text/javascript"><!--
google_ad_client = "';
/* 300x250, created 5/7/09 */
google_ad_slot = "";
google_ad_width = 300;
google_ad_height = 250;
<script type="text/javascript"


<td width=300 align=left valign=top><img src=images/!.gif width=16 height=16 border=0><font color=#ff0000><b> This is reduced image, just follow 'How to use' instructions to set wallpaper.</b></font></td>

05-12-2009, 01:02 AM
google_ad_client = "';

You are opening a double quote and closing a single quote there.

05-12-2009, 01:06 AM
Thanks for the help! That is sample google code... even when the google code is correct, it still makes the page a blank page? Any ideas on how to properly insert the Google Script there?

05-13-2009, 06:34 AM
You are not properly escaping the quotation marks with slashes.

05-16-2009, 11:41 AM
People its important to note there is a option when you created the add to show nothing if there is no add to display. It may be that the code is fine you just have to give it a little time then it will show up. I got hit with this before so keep it in mind.

I think the best way if your using the same add code over and over is just to make a php function to echo it for you. This really cleans up the look of the pages and avoids stupid typos. But bare in mind i am pretty new to this php stuff, so there might be some disadvantage to this I am unaware off.