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 error

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-15-2006, 03:26 PM THREAD STARTER               #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



php error


It says unexpected t_variable or something - line 6 (highlighted)

PHP Code:
$sub $_SERVER['HTTP_HOST']; // get host
????: NamePros.com http://www.namepros.com/programming/197636-php-error.html
$domain "6yd.net";
$sub eregi_replace($domain"" $sub); //<-- line 6?!
$sub eregi_replace("www\."""$sub);
$sub strtolower($sub);
if(!empty(
$sub)){
  include(
"shorturl/do_short_url.php");

anyone know what's wrong?

Thanks
Tom
Last edited by SecondVersion; 05-15-2006 at 04:18 PM. Reason: [COLOR] doesn't work in [PHP] ;)
PoorDoggie is offline  
Old 05-15-2006, 03:35 PM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
PHP Code:
[COLOR=Red]$sub eregi_replace($domain"" $sub);[/COLOR
that is your problem

presumably you meant to have:-

PHP Code:
$sub eregi_replace($domain"" $sub); 
but this is still wrong it should be (notice the comma after the quotes) :-

PHP Code:
$sub eregi_replace($domain""$sub); 
????: NamePros.com http://www.namepros.com/showthread.php?t=197636
Peter is offline  
Old 05-15-2006, 03:44 PM   #3 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
He meant to have the [COLOR] stuff there so you could find it easier.. but that doesn't work in [PHP].

All you need is a comma. ^^
Dan is offline  
Old 05-15-2006, 04:30 PM   #4 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease
As Peter showed, the leaving out of the comma was the problem.

But just a note, you should always try to optimize what you can in PHP to make things nice and quick, every little bit counts.

So for the first line I'd suggest using str_replace rather than eregi_replace, as its quicker to process.

So line 6 would be: $sub = str_replace($domain,"",$sub);

All the best!
Rhett.
BillyConnite is offline  
Old 05-16-2006, 12:17 AM   #5 (permalink)
Senior Member
 
Xyzer's Avatar
Join Date: Aug 2005
Location: United Kindom
Posts: 1,502
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
 


Tsunami Relief AIDS/HIV
I hate it when i come to programming threads, i work it out and find the problem, scroll down the thread and its finished lol.
Xyzer is offline  
Old 05-16-2006, 11:21 AM THREAD STARTER               #6 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



Thanks a lot everyone, I can never figure it out, post it here, and then feel so stupid because it is sooooo obvious. Thanks for all your help though

[QUOTE=BillyConniteSo line 6 would be: $sub = str_replace($domain,"",$sub);
[/QUOTE]

is str_replace() case dependant though? eregi_replace isn't which is why I use it. I suppose in this case I could use "strtolower" or something.

Thanks
Tom
PoorDoggie is offline  
Old 05-16-2006, 11:25 AM   #7 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
http://us3.php.net/manual/en/function.str-ireplace.php

Not case sensitive str_ireplace.

webmonkey: scroll down first?
Dan is offline  
Old 05-16-2006, 11:32 AM   #8 (permalink)
Senior Member
 
Xyzer's Avatar
Join Date: Aug 2005
Location: United Kindom
Posts: 1,502
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
 


Tsunami Relief AIDS/HIV
Good idea Dan, But i like to know that i know.
Xyzer 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 06:25 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