[advanced search]
Results from the most recent live auction are here.
20 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 06-10-2008, 02:07 PM   · #1
Amma
NamePros Regular
 
Amma's Avatar
 
Trader Rating: (23)
Join Date: Jul 2006
Posts: 525
NP$: 52.50 (Donate)
Amma is just really niceAmma is just really niceAmma is just really niceAmma is just really nice
Parse error: syntax error, unexpected T_IF in

Hi,

For some reason I get the below error. Can someone find where this is going wrong?

Parse error: syntax error, unexpected T_IF in /home/www/mydomain(.)com/page_search.php on line 8

Here is the code
PHP Code:
<?php

    
+ // We urlencoded the whole search string so we need to
    
+ // urldecode and convert it back to utf-8
    
+ $id = $id === 0 ? '' : utf8_encode(urldecode($id));
    +

    if (
$id != '' && !strstr($id, '|'))
    {
        
$keywords = $db->real_escape_string(trim($id));
    }

Thanks


Please register or log-in into NamePros to hide ads
Amma is offline   Reply With Quote
Old 06-10-2008, 02:32 PM   · #2
sdsinc
Law and disorder
 
sdsinc's Avatar
 
Name: Kate
Location: Expat
Trader Rating: (57)
Join Date: Aug 2005
Posts: 5,298
NP$: 1128.11 (Donate)
sdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond reputesdsinc has a reputation beyond repute
Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV
Missing ?> at the end of the code
__________________
Now on sale: BudgetLettings.com
sdsinc is offline   Reply With Quote
Old 06-10-2008, 02:51 PM   · #3
psalzmann
NamePros Regular
 
Trader Rating: (20)
Join Date: Feb 2006
Posts: 517
NP$: 360.80 (Donate)
psalzmann is just really nicepsalzmann is just really nicepsalzmann is just really nicepsalzmann is just really nice
No,

Remove the + from your code. Replace them with //

Regards,
Peter
psalzmann is offline   Reply With Quote
Old 06-10-2008, 05:17 PM   · #4
mholt
DNOA Member
 
mholt's Avatar
 
Name: Matthew Holt
Location: 127.0.0.1
Trader Rating: (75)
Join Date: May 2004
Posts: 4,869
NP$: 17.21 (Donate)
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Or just take them out entirely.
__________________
www.mwholt.com
mholt is offline   Reply With Quote
Old 06-10-2008, 05:20 PM   · #5
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter
Location: Scotland
Trader Rating: (45)
Join Date: Nov 2003
Posts: 4,169
NP$: 1032.15 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
Originally Posted by Kath
Missing ?> at the end of the code




?> is not required at the end of a php scrpt. some people purposely leave them out as it can stop problems occuring
Peter is offline   Reply With Quote
Old 06-10-2008, 05:49 PM   · #6
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 


Name: Eric
Location: Kentucky
Trader Rating: (142)
Join Date: Mar 2005
Posts: 4,238
NP$: 408.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
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 Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Originally Posted by peter@flexiwebhost
?> is not required at the end of a php scrpt. some people purposely leave them out as it can stop problems occuring


indeed! Those damn 'output started....' errors, ugh
__________________

SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.2 now available!!
MetaCreator.com - Free Meta Tag Creator
CodingPlanet.com - Coming soon...
SecondVersion is offline   Reply With Quote
Old 06-10-2008, 09:30 PM   · #7
rafaelrls
NamePros Member
 
rafaelrls's Avatar
 
Location: me = new (live(in.paradise())
Trader Rating: (-1)
Join Date: Jan 2008
Posts: 154
NP$: 0.00 (Donate)
rafaelrls is an unknown quantity at this point
your remarks are wrong.
php remarks are: /*whatever thing you write*/
or //whatever thing you write
rafaelrls is offline   Reply With Quote
Old 06-10-2008, 10:52 PM   · #8
Amma
NamePros Regular
 
Amma's Avatar
 
Trader Rating: (23)
Join Date: Jul 2006
Posts: 525
NP$: 52.50 (Donate)
Amma is just really niceAmma is just really niceAmma is just really niceAmma is just really nice
Originally Posted by Kath
Missing ?> at the end of the code


?> is there, it is in end of the code

Originally Posted by psalzmann
No,

Remove the + from your code. Replace them with //

Regards,
Peter


I will try to replace with // but it says the error in line 8. Is there any error in this line
PHP Code:
if ($id != '' && !strstr($id, '|'))

Last edited by Amma : 06-10-2008 at 10:56 PM.
Amma is offline   Reply With Quote
Old 06-11-2008, 08:23 AM   · #9
rafaelrls
NamePros Member
 
rafaelrls's Avatar
 
Location: me = new (live(in.paradise())
Trader Rating: (-1)
Join Date: Jan 2008
Posts: 154
NP$: 0.00 (Donate)
rafaelrls is an unknown quantity at this point
Originally Posted by Amma
?> is there, it is in end of the code


I will try to replace with // but it says the error in line 8. Is there any error in this line
PHP Code:
if ($id != '' && !strstr($id, '|'))


Man, first clean the code (correct the remarks). Them you should see an error report more acurate.
rafaelrls is offline   Reply With Quote
Old 06-11-2008, 10:11 AM   · #10
Amma
NamePros Regular
 
Amma's Avatar
 
Trader Rating: (23)
Join Date: Jul 2006
Posts: 525
NP$: 52.50 (Donate)
Amma is just really niceAmma is just really niceAmma is just really niceAmma is just really nice
Originally Posted by rafaelrls
Man, first clean the code (correct the remarks). Them you should see an error report more acurate.


I tried both way as below and replacing // instead of + but the error is same
PHP Code:
<?php
/** We urlencoded the whole search string so we need to
  * urldecode and convert it back to utf-8
  */
  
+ $id = $id === 0 ? '' : utf8_encode(urldecode($id));
  +

        if (
$id != '' && !strstr($id, '|'))
    {
        
$keywords = $db->real_escape_string(trim($id));
    }

I'm not a coder and I couldn't catch the coder who created this. Any help will be highly apreciated.
Amma is offline   Reply With Quote
Old 06-11-2008, 10:18 AM   · #11
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter
Location: Scotland
Trader Rating: (45)
Join Date: Nov 2003
Posts: 4,169
NP$: 1032.15 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
there doesnt seem to be anything wrong with the if statement but until you remove the + signs the error messages are meaningless.

If you ask for advice and help why do you not follow the advice?
Peter is offline   Reply With Quote
Old 06-11-2008, 11:18 AM   · #12
Amma
NamePros Regular
 
Amma's Avatar
 
Trader Rating: (23)
Join Date: Jul 2006
Posts: 525
NP$: 52.50 (Donate)
Amma is just really niceAmma is just really niceAmma is just really niceAmma is just really nice
psalzmann, rafaelrls and Peter McDonald thanks for all and also thanks to others who commented this thread.

The problem solved by removing the + and replacing //.
Quote:
If you ask for advice and help why do you not follow the advice?


I tried immediately when I show psalzmann's comment but I replaced // for all 4 + as below
PHP Code:
<?php

    
// We urlencoded the whole search string so we need to
    // urldecode and convert it back to utf-8
    // $id = $id === 0 ? '' : utf8_encode(urldecode($id));
    

Sorry I'm zero with PHP

After checking with some other PHP codes I tried replacing // first two lines then peter@flexiwebhost you remind me to try by removing the + in second and third line.
Corrected code
PHP Code:
<?php
/** We urlencoded the whole search string so we need to
  * urldecode and convert it back to utf-8
  */
   
$id = $id === 0 ? '' : utf8_encode(urldecode($id));
  
        if (
$id != '' && !strstr($id, '|'))
    {
        
$keywords = $db->real_escape_string(trim($id));
    }

It's works fine. Rep added for all

Thanks again.
Amma
Amma is offline   Reply With Quote
Reply

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
http://www.mobisitetrader.com/ Find out how! Exdon
Advertise your business at NamePros
All times are GMT -7. The time now is 06:10 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0