For loop: syntax error, unexpected T_INC
Hi all,
I have some content which I would like to limit to 9 per page in a table. I haven't done the table code yet, and rather concentrate on trying to get the filter working.
When I try to enter the URL of index.php, where page=2 or without a page number I am getting an error in my for loop.
Parse error: syntax error, unexpected T_INC, expecting ')' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 22
<?php
session_start();
if (isset($_GET['page']))
{
$page=$_GET['page'];
}
else
{
$page=1;
}
include('functions.php');
get_videos($conn);
gen_header($page);
?>
<div id="container"><?php nav_bar(); ?>
<?php
$cols=0;
for($i=1*$page;$page*9;i++)
{
echo $i;
}
?>
</div>
<?php gen_footer(); ?>
The line PHP doesn't like is the for loop but I can't think of another way to limit the content. How do I fix this?
Related Article: syntax error - unexpected T_variable
is a solved PHP discussion thread by salii that has 10 replies, was last updated 1 year ago and has been tagged with the keywords: php, syntax, error.
bsewell
Junior Poster in Training
70 posts since Sep 2009
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0
Is it correct?
for($i=1*$page;[B]$page*9[/B];i++)
{
echo $i;
}
The bold section should be a condition r8?
rajarajan07
Nearly a Posting Virtuoso
1,450 posts since May 2008
Reputation Points: 167
Solved Threads: 241
Skill Endorsements: 1