Unstoppable Domains

PHP Help (Should be easy...)

Spaceship Spaceship
Watch

D14Posters

Established Member
Impact
1
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_e4b8fa4b28026552eb3a825d88b4fb36_http%3A//search.ebay.com/britney-spears_W0QQfromZR34">Buy Britney Spears Merchandise</a>

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
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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.
$name1 would be "Britney"
$name2 would be "Spears"

this is the quickest way.
 
0
•••
PHP:
<?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>";

echo $ads;

?>
 
0
•••
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?
 
0
•••
then you could just..

PHP:
<?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>';

echo $ads;

?>
 
0
•••
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; 

?>
 
0
•••
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
 
0
•••
D14Posters said:
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
PHP:
<?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:
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:
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back