Re: Pagination Part 2
| From: | Jonathan Pitcher | Date: | Wed, 12 Mar 2003 19:15:16 +0000 |
| Subject: | Re: Pagination Part 2 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139369@lists.php.net to get a copy of this message | ||
You are mixing and matching your If statements.
if ()
else
AND
if () {
} else {
}
Be consistent. It looks like if you close the { tags your code should work ok.}
Hope this helps,
Jonathan Pitcher
On Wednesday, March 12, 2003, at 01:11 PM, conbud wrote:
Hi, Ive been trying to get this to work but I keep getting this error Parse error: parse error, unexpected $ in /home/conbud/nrlug/test3.php on line 72 line 72 is just the ending php bracket, heres what I got: <?php@mysql_connect(localhost, root, boing_boing) or die("ERROR--CAN'T CONNECT TO SERVER"); @mysql_select_db("nrlug") or die("ERROR--CAN'T CONNECT TO DB");$limit = 2; $query_count = "SELECT lnkname FROM links"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count);if(empty($page)) $page = 1;$limitvalue = $page * $limit - ($limit); $query = "SELECT * FROM links LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error());if(mysql_num_rows($result) == 0) echo("Nothing to Display!");$bgcolor = "#E0E0E0"; // light grayecho("<table>");while($row = mysql_fetch_array($result)){ if($bgcolor == "#E0E0E0") $bgcolor = "#FFFFFF"; else $bgcolor = "#E0E0E0";echo("<tr bgcolor=".$bgcolor.">\n<td>"); echo($row['lnkname']); echo("<td>\n\<td>"); echo($row['id']); echo("<td>\n</tr>"); }echo("</table>");if($page != '1'){ $pageprev = $page--;echo("<a href=\"$PHP_SELF&page=$pageprev\">PREV</a> "); }else echo("PREV ");$numofpages = $totalrows / $limit;for($i = '1'; $i <= $numofpages; $i++){ if($i == $page) echo($i." "); else echo("<a href=\"$PHP_SELF&page=$i\">$i</a> ");if(($totalrows % $limit) != '0'){ if($i == $page) echo($i." "); else echo("<a href=\"$PHP_SELF&page=$i\">$i</a> ");if(($totalrows - ($limit * $page)) > '0'){ $pagenext = $page++;echo("<a href=\"$PHP_SELF&page=$pageprev\">NEXT</a>"); }else echo(" NEXT ".$limit);mysql_free_result($result);?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php