NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Help (should be easy...)

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-11-2007, 04:07 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Aug 2006
Posts: 110
D14Posters is on a distinguished road
 



PHP Help (should be easy...)


Hi,

I wanted to see if someone could help me here. I don“t know php so the terminology might not be right... If this takes longer than I think I can paypal someone some money for their efforts.

I have a site with a database that has the celebrity names and when the names show up on the celebrity page (say Britney Spears page) they are called up using $name. I wanted to insert this code: <a href="http://ads.auctionads.com/pagead/link_59da060bb6f873222888_e4b8fa4b28026552eb3a825d 88b4fb36_http%3A//search.ebay.com/britney-spears_W0QQfromZR34">Buy Britney Spears Merchandise</a>
????: NamePros.com http://www.namepros.com/programming/326785-php-help-should-be-easy.html

on the celebrity pages, where "britney spears" is substituted by the actual celebrity name for that page. How do I do it so that I can insert $name and have the celebrity name appear...

sorry for the confusing explanation

thanks
D14Posters is offline  
Old 05-11-2007, 04:16 PM   #2 (permalink)
JFS
NamePros Regular
 
JFS's Avatar
Join Date: Oct 2005
Location: Portugal
Posts: 800
JFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to all
 



it's easy...
Code:
<?php

$ads = " 
<a href='http://ads.auctionads.com/pagead/link_59da060bb6f873222888_e4b8fa4b28026552eb3a825 d88b4fb36_http%3A//search.ebay.com/".$name1."-".$name2."_W0QQfromZR34'>Buy ".$name1." ".$name2." Merchandise</a> 
";

echo $ads;
?>
why the $name1 e $name2 ?
because you can't have a $name being "britney-spears" and "Britney Spears" at the same time.
????: NamePros.com http://www.namepros.com/showthread.php?t=326785
$name1 would be "Britney"
$name2 would be "Spears"

this is the quickest way.
__________________
Joćo Fernandes Silva
JFS is offline  
Old 05-11-2007, 04:27 PM   #3 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
PHP Code:
<?php

$ads 
"<a href=\"http://ads.auctionads.com/pagead/link_59da060bb6f873222888_e4b8fa4b28026552eb3a825 d88b4fb36_http%3A//search.ebay.com/$name1-{$name2}_W0QQfromZR34\}>Buy " ucfirst($name1) . " " ucfirst($name2) . " Merchandise</a>";
????: NamePros.com http://www.namepros.com/showthread.php?t=326785

echo 
$ads;

?>
Eric is offline  
Old 05-11-2007, 04:49 PM THREAD STARTER               #4 (permalink)
NamePros Member
Join Date: Aug 2006
Posts: 110
D14Posters is on a distinguished road
 



Thanks for the two very quick replies!

BUT, the database is already there and the one name "britney spears" or "Cristiano ronaldo" are already on the database and are one string ($name).

did what i just say make sense?
D14Posters is offline  
Old 05-11-2007, 05:04 PM   #5 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
then you could just..

PHP Code:
<?php

$ads 
'<a href="http://ads.auctionads.com/pagead/link_59da060bb6f873222888_e4b8fa4b28026552eb3a825d88b4fb36_http%3A//search.ebay.com/' str_replace(' ''-'strtolower($name)) . '_W0QQfromZR34">Buy ' ucwords($name) . ' Merchandise</a>';
????: NamePros.com http://www.namepros.com/showthread.php?t=326785

echo 
$ads;

?>
Eric is offline  
Old 05-11-2007, 05:05 PM   #6 (permalink)
JFS
NamePros Regular
 
JFS's Avatar
Join Date: Oct 2005
Location: Portugal
Posts: 800
JFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to allJFS is a name known to all
 



yes.

then something like this should work
Code:
<?php 

$names = str_word_count($name,1);


$ads = "<a href=\"http://ads.auctionads.com/pagead/link_59da060bb6f873222888_e4b8fa4b28026552eb3a825 d88b4fb36_http%3A//search.ebay.com/$names['0']-{$names['1']}_W0QQfromZR34\}>Buy " . ucfirst($names['0']) . " " . ucfirst($names['1']) . " Merchandise</a>"; 

echo $ads; 

?>
__________________
Joćo Fernandes Silva
JFS is offline  
Old 05-11-2007, 07:31 PM THREAD STARTER               #7 (permalink)
NamePros Member
Join Date: Aug 2006
Posts: 110
D14Posters is on a distinguished road
 



Thank you very much for both of you!!!

SecondVersion, I have another "easy" request. I was going to PM you but since I think this might be of general interest for AuctionAds users I will ask for your help again.

Using the above information, how would I go about inserting the celebrity name on the following line of auctionads code:

auctionads_ad_kw = "britney spears";

Also, since I can use several keywords on this code separated by a ";" I would like to have a "default" keyword of "paris hilton"

Thanks again and let me know if I can paypal you something for your time!

Fernandes
D14Posters is offline  
Old 05-11-2007, 07:41 PM   #8 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by D14Posters
Thank you very much for both of you!!!

SecondVersion, I have another "easy" request. I was going to PM you but since I think this might be of general interest for AuctionAds users I will ask for your help again.
????: NamePros.com http://www.namepros.com/showthread.php?t=326785

Using the above information, how would I go about inserting the celebrity name on the following line of auctionads code:

auctionads_ad_kw = "britney spears";

Also, since I can use several keywords on this code separated by a ";" I would like to have a "default" keyword of "paris hilton"

Thanks again and let me know if I can paypal you something for your time!

Fernandes
PHP Code:
<?php

// your db code here, pulling names.. possibly make an array of names
// then..
?>
auctionads_ad_kw = "paris hilton;<?php echo implode(';'$names); ?>";
or, if you meant you could have several 'auctionads_ad_kw'
PHP Code:
auctionads_ad_kw = "paris hilton";
<?php

// your db code here, pulling names.. while looping through names..
echo 'auctionads_ad_kw = "' $name '";' "\n";

?>
And no $$ is necessary

But, if you feel like you must, you can donate @ www.domainportfolio.us
Last edited by SecondVersion; 05-11-2007 at 07:48 PM.
Eric is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:52 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger