Re: Syntax error
| From: | Chris Lee | Date: | Mon, 27 Nov 2000 09:03:20 +0000 |
| Subject: | Re: Syntax error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27512@lists.php.net to get a copy of this message | ||
<?
$winner = 111110011100111;
$y = 0;
mysql_connect ("localhost","mpeloso","ampeloso") or
die("a");
mysql_select_db("ampsoft_com") or die("b");
$resulta = mysql_query("Select User,Picks from Picks");
while($row=mysql_fetch_row($resulta))
{
$x = $row[1];
echo $x;
for($i=0;$i<strlen($x);$i++)
{
echo $i;
if ((substr($x,$i,1)==(substr($winner,$i,1))
{
$y++;
echo $y;
}
}
}
?>
You were putting the {} in the wrong spots
I allways line things up, easier to see errors like yours.
Chris Lee
Mediawaveonline.com
In article <8vus78$lvp$1@toye.p.sourceforge.net>, mpeloso@ampsoft.com
wrote:
> I keep getting a syntax error on line 25($y++).Ive tried every thing.I
> would appreciate some help and some insight into the nesting rules.
> $winner=111110011100111;
> $y=0;
> mysql_connect ("localhost","mpeloso","ampeloso") or
> die("a");
> mysql_select_db("ampsoft_com") or die("b");
> $resulta = mysql_query("Select User,Picks from Picks");
> while($row=mysql_fetch_row($resulta))
> {$x = $row[1];
> echo $x;
> {for($i=0;$i<strlen($x);$i++)
> echo $i;
> {if ((substr($x,$i,1)==(substr($winner,$i,1))
> $y++;
> echo $y;}
> }}
>
>
> mpeloso@princeton.edu
>
>
>