Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 14-09-06
Frostie's Avatar
Moderator
 
Join Date: Aug 2003
Location: Wirral
Posts: 3,012
Thanks: 7
Thanked 13 Times in 6 Posts
Frostie is on a distinguished roadFrostie is on a distinguished road
  PHP Select Help

All

I have the following basic piece of code which is now, officially, doint my nut in as I can't get it to work the way I want it to and wondered if someone can tell me where I am going wrong?

Code:
<?php
$connection = mysql_connect($host,$user,$password)
or die ("Connection Error");

$db = mysql_select_db($database,$connection)
or die ("Database Error");

$query = "SELECT company FROM company ORDER BY company ASC";
$result = mysql_query($query)
or die ("Query Error");

while ($row = mysql_fetch_object($result))
{
$remcompany = htmlspecialchars($row->company);

print "<tr><td><a href=".$remcompany."_deals.html'>$remcompany Deals</a></td></tr>";
}
?>
The text shows correctly, with spaces, as in;
Argos Deals
The Gadget Shop Deals

But the links dont, as they are affected by the spaces. I want them to show as such (but appear as such);
Argos Deals.html (Argos Deals.html)
The Gadget Shop Deals.html (The)

I know the where the problem lies, but not what the problem is. Anyone any ideas?
__________________
Affiliate Blog | Eco Friendly | Discount Codes - Exclusive codes = Inclusion in newsletter to 26,000 recipients
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 14-09-06
kungfumobiles's Avatar
Block Chopping Prices!
 
Join Date: Oct 2005
Location: Liverpool
Posts: 294
Thanks: 0
Thanked 0 Times in 0 Posts
kungfumobiles is an unknown quantity at this point
Code:
print "<tr><td><a href=".$remcompany."_deals.html'>$remcompany Deals</a></td></tr>";
try

Code:
echo '<tr><td><a href="'.$remcompany.'_deals.html">'.$remcompany.' Deals</a></td></tr>';
__________________
AffiliStore 2 create FREE Affiliate Marketing Websites from multiple merchant product feeds.

Examples:
Cheapest Mobile Phones | New Football Kits
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 14-09-06
Super Moderator
 
Join Date: Aug 2003
Posts: 1,984
Thanks: 1
Thanked 1 Time in 1 Post
Fraser seems to know their stuff
You could replace your spaces with another character i.e.

$linkremcompany=str_replace(" ","-",$remcompany);

and then use that in the link.

You would also be better to use a hyphen rather than an underscore.

If you are then using modrewrite you will need to replace your hypens with spaces again before you look up the merchant name in your database.

Doe that make sense or have I not even understood the question?
__________________
Fraser

Affiliate Blog & Podcast
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 14-09-06
drivetowin's Avatar
Driving to win
 
Join Date: Aug 2003
Location: If I'm not at home, I'm in hospital
Posts: 7,363
Thanks: 5
Thanked 8 Times in 5 Posts
drivetowin seems to know their stuff
Chris

What are the actual page names

ie is it

The Gadget Shop_deals.html

The_Gadget_Shop_deals.html

the_gadget_shop_deals.html

Assuming $remcompany contains The Gadget Shop

for the first one you want

Code:
echo '<tr><td><a href="'. urlencode($remcompany) . '_deals.html">'.$remcompany.' Deals</a></td></tr>';
for the second one you want

Code:
echo '<tr><td><a href="'. str_replace(" ","_",$remcompany).'_deals.html">'.$remcompany.' Deals</a></td></tr>';
and for the third one you want

Code:
echo '<tr><td><a href="'.strtolower(str_replace(" ","_",$remcompany)).'_deals.html">'.$remcompany.' Deals</a></td></tr>';
__________________
Never argue with idiots. They just drag you down to their level and then beat you with their experience.

If ignorance is bliss then some of the people I know must be orgasmic.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 14-09-06
Frostie's Avatar
Moderator
 
Join Date: Aug 2003
Location: Wirral
Posts: 3,012
Thanks: 7
Thanked 13 Times in 6 Posts
Frostie is on a distinguished roadFrostie is on a distinguished road
Quote:
Originally Posted by Fraser
Does that make sense or have I not even understood the question?
Makes Sense
Implemented
Works A Treat
Cheers Ears
__________________
Affiliate Blog | Eco Friendly | Discount Codes - Exclusive codes = Inclusion in newsletter to 26,000 recipients
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 14-09-06
Frostie's Avatar
Moderator
 
Join Date: Aug 2003
Location: Wirral
Posts: 3,012
Thanks: 7
Thanked 13 Times in 6 Posts
Frostie is on a distinguished roadFrostie is on a distinguished road
OOOoooo another thought :eek:

Is there anyway I could build into the code a little something that would make it all lowercase automatically?
__________________
Affiliate Blog | Eco Friendly | Discount Codes - Exclusive codes = Inclusion in newsletter to 26,000 recipients
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 14-09-06
Super Moderator
 
Join Date: Aug 2003
Posts: 1,984
Thanks: 1
Thanked 1 Time in 1 Post
Fraser seems to know their stuff
Keith's third answer has that bit in it. Just use the

strtolower()

function. Or carrying on from my answer


$linkremcompany=strtolower(str_replace(" ","-",$remcompany));
__________________
Fraser

Affiliate Blog & Podcast
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 14-09-06
Frostie's Avatar
Moderator
 
Join Date: Aug 2003
Location: Wirral
Posts: 3,012
Thanks: 7
Thanked 13 Times in 6 Posts
Frostie is on a distinguished roadFrostie is on a distinguished road
I love u guys

EDIT
In a manly, slap on the back, rugby tackle style of course!
__________________
Affiliate Blog | Eco Friendly | Discount Codes - Exclusive codes = Inclusion in newsletter to 26,000 recipients
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP select distinct lowndsy Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 8 08-02-05 04:11 PM
Anyone anygood with xml, php, mysql and Affiliate Window AnnonnyMouse The Affiliate Marketing Lounge 1 23-09-04 11:00 AM
php - Select DISTINCT ? DaveR Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 11 14-05-04 10:54 PM
PHP or Browser Timeout? Barry Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 6 28-04-04 01:04 PM
Ad Select Campaigns adselect Advertising.com 0 24-10-03 05:35 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7