Reply
This Error Is Driving Me Mad
Old 07-20-2003, 04:28 PM This Error Is Driving Me Mad
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Please help me someone!!!!

I've been coding for a while so I might be missing something obvious, but I'm getting a PHP parse error in my code. It's brining up the last line in this snippet as the error.

PHP Code:
if($gpd1n<1) {
    exit;
} else {
    
$i=0;

    
$currplan=mysql_result($gpd1r,$i,"planid");
    
$pid=-1;
    
$currfeature=mysql_result($gpd1r,$i,"featureid");
    
    while(
$currfeature!="")
        
$pid++;
        for(
$x=0$x<=$sizfeattab$x++) {
            if(
$feattab[0][$x]==$currfeature) {
                
$feattab[$pid+3][$x]="Y";
                if(
$i!=$gpd1n) {
                    
$i++;
                    
$currfeature=mysql_result($gpd1r,$i,"featureid");
                    
$currplan=mysql_result($gpd1r,$i,"planid");
                } else {
                    
$currfeature="";
                }
            } else {
                
$feattab[$pid+3][$x]="N";
            }
        }
    }
        

    
    if(
$feature['lastcat']!=$feature['category']) {
        
$feattab[1][$i]=$feature['category'];
    } else {
        
$feattab[1][$i]="&nbsp;";
    }
    
    
$feattab[2][$i]=$feature['name'];
    
$feattab[0][$i]=$feature['id'];
            
    
$feature['lastcat']=$feature['category'];
    

Please help! This is driving me mad!
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
When You Register, These Ads Go Away!
Old 07-22-2003, 12:36 PM
theblt's Avatar
Super Talker

Posts: 119
Wow that's a toughy. I'm looking at the code and I can't find anything at all. May I recommend that you visit Macromedia's website at http://www.macromedia.com . Check out their forums and newsgroups and see if they might know over there. They got some pretty smart coders who visit the newsgroups regularly.
theblt is offline
Reply With Quote
View Public Profile Visit theblt's homepage!
 
Old 07-22-2003, 02:07 PM
eConcept-Web's Avatar
Skilled Talker

Posts: 82
what is the error ???
__________________
======================================
Web Hosting and Web Design Services
Site: http://www.econcept-web.com
eMail: info@econcept-web.com
MSN: Support@econcept-web.com
======================================
eConcept-Web is offline
Reply With Quote
View Public Profile Visit eConcept-Web's homepage!
 
Old 07-22-2003, 02:41 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
It was a parse error in the last line of the code.

Thanks for the idea, theblt. I'll need to check them. I'm OK for now, though, rewrote the system a different way and it does what I need, so I'm happy!
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
Old 07-27-2003, 09:42 PM
Cagez's Avatar
Skilled Talker

Posts: 62
I don't like your stye of coding it makes it hard to spot missing {}'s.

An error on the last line usually means you forgot a curly somewhere. I think you forgot a { after your while

PHP Code:
while($currfeature!="")
// here? I'm not sure if you included a }, too lazy to check :-P 
Cagez is offline
Reply With Quote
View Public Profile
 
Old 07-28-2003, 06:20 AM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Well spotted Cagez!

You're proably right about the coding style!
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
Old 08-15-2003, 09:05 AM
Skilled Talker

Posts: 67
Location: New Zealand
A good trick or tip is to always comment your ending bracket. Eg:


PHP Code:
while(1) {
    if (
== 3) {
        print 
"does anyone care?";
    } 
// if end
// while end 
But really I like to use the following style

PHP Code:
while(1)
    {
    if (
== 3)
        {
        print 
"does anyone care?";
        }
    } 
__________________
cheap php web hosting - PayPal Accepted
PhilG is offline
Reply With Quote
View Public Profile Visit PhilG's homepage!
 
Old 08-16-2003, 01:41 PM
Skilled Talker

Posts: 52
Location: Leamington, UK
I find the best way of indenting code is to indent after the brace like this:

PHP Code:
if ($foo == $bar)
{
    echo 
$bar;

but this is just preference and the way my editer auto indents the code
__________________
Stewart McIntosh -
stewis is offline
Reply With Quote
View Public Profile
 
Old 08-16-2003, 05:01 PM
Cagez's Avatar
Skilled Talker

Posts: 62
I do it that way too stewis, I find it easier to differentiate code blocks that way.
Cagez is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to This Error Is Driving Me Mad
 

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14352 seconds with 12 queries