> -----Original Message-----
> From: conbud [mailto:[EMAIL PROTECTED]
> Sent: 12 March 2003 19:12
>
>
> 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,
Well, this is a pretty cryptic PHP error message -- $ in this context just means "end
of file" (similar to its use in preg/ereg patterns!). The most likely cause of this
is that you have an unmatched opening brace {.
> 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 gray
>
> echo("<table>");
>
> while($row = mysql_fetch_array($result)){
brace level: 1
> 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>");
> }
brace level: 0
>
> echo("</table>");
>
> if($page != '1'){
brace level: 1
> $pageprev = $page--;
>
> echo("<a href=\"$PHP_SELF&page=$pageprev\">PREV</a> ");
> }else
brace level: 0
> echo("PREV ");
>
> $numofpages = $totalrows / $limit;
>
> for($i = '1'; $i <= $numofpages; $i++){
brace level: 1
> if($i == $page)
> echo($i." ");
> else
> echo("<a href=\"$PHP_SELF&page=$i\">$i</a> ");
>
>
> if(($totalrows % $limit) != '0'){
brace level: 2
> if($i == $page)
> echo($i." ");
> else
> echo("<a href=\"$PHP_SELF&page=$i\">$i</a> ");
>
> if(($totalrows - ($limit * $page)) > '0'){
brace level: 3
> $pagenext = $page++;
>
> echo("<a href=\"$PHP_SELF&page=$pageprev\">NEXT</a>");
> }else
brace level: 2
> echo(" NEXT ".$limit);
>
> mysql_free_result($result);
>
> ?>
Uh -- brace level is still 2, which means you have 2 unclosed opening braces. Put
those in at the appropriate places (and your indentation is pretty suggestive of where
that is!) and all should be fine.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php