Reply
if else problem
Old 11-25-2004, 03:00 PM if else problem
Novice Talker

Posts: 12
Location: Belgium
Hi, here s my problem
im editing a code of a downloaded script
cuz im a newbie, i dont know whats wrong, but the thingy gives an error of: unexpected '{' in the 1 line...

PHP Code:
if ($totalanswers == 0) {$percentperanswer=0}
    else
    {
    for(
$i=0;$i<count($answerscountarray);$i++);
       
$percentperanswer[$i]=round((($answerscountarray[$i]*100)/$totalanswers),1)."%";
    } 
thx in advance for your help...
snake903 is offline
Reply With Quote
View Public Profile Visit snake903's homepage!
 
When You Register, These Ads Go Away!
Old 11-25-2004, 03:24 PM
Skilled Talker

Posts: 83
Location: Ohio
Try this:

Code:
if ($totalanswers == 0) 
{
$percentperanswer=0;
} 
    else 
    { 
    for($i=0;$i<count($answerscountarray);$i++); 
       $percentperanswer[$i]=round((($answerscountarray[$i]*100)/$totalanswers),1)."%"; 
    }
You forgot ";"
techguru is offline
Reply With Quote
View Public Profile
 
Old 11-26-2004, 09:44 AM
Novice Talker

Posts: 12
Location: Belgium
thx, stupid me
snake903 is offline
Reply With Quote
View Public Profile Visit snake903's homepage!
 
Old 11-26-2004, 10:31 AM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
You need to drop the semicolon on the end of your for loop.
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Reply     « Reply to if else problem
 

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.11539 seconds with 12 queries